| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | #include "allegro/file.h" | ||
| 2 | #include "base/util.h" | ||
| 3 | #include "base/version.h" | ||
| 4 | #include "base/zapp.h" | ||
| 5 | #include "base/qrs.h" | ||
| 6 | #include "base/cpool.h" | ||
| 7 | #include "base/autocombo.h" | ||
| 8 | #include "base/packfile.h" | ||
| 9 | #include "base/dmap.h" | ||
| 10 | #include "base/combo.h" | ||
| 11 | #include "base/msgstr.h" | ||
| 12 | #include <filesystem> | ||
| 13 | #include <memory> | ||
| 14 | #include <optional> | ||
| 15 | #include <stdio.h> | ||
| 16 | #include <cstring> | ||
| 17 | #include <string> | ||
| 18 | #include <map> | ||
| 19 | #include <vector> | ||
| 20 | #include <assert.h> | ||
| 21 | #include <fmt/format.h> | ||
| 22 | |||
| 23 | |||
| 24 | #include "metadata/sigs/devsig.h.sig" | ||
| 25 | #include "metadata/sigs/compilersig.h.sig" | ||
| 26 | #include "metadata/versionsig.h" | ||
| 27 | #include "base/zc_alleg.h" | ||
| 28 | #include "base/zdefs.h" | ||
| 29 | #include "base/colors.h" | ||
| 30 | #include "tiles.h" | ||
| 31 | #include "base/zsys.h" | ||
| 32 | #include "qst.h" | ||
| 33 | #include "defdata.h" | ||
| 34 | #include "subscr.h" | ||
| 35 | #include "zc/replay.h" | ||
| 36 | #include "zc/zasm_utils.h" | ||
| 37 | #include "zc/zc_custom.h" | ||
| 38 | #include "sfx.h" | ||
| 39 | #include "md5.h" | ||
| 40 | #include "zinfo.h" | ||
| 41 | #include "zc/ffscript.h" | ||
| 42 | #include "particles.h" | ||
| 43 | #include "dialog/alert.h" | ||
| 44 | #include "base/misctypes.h" | ||
| 45 | #include "base/initdata.h" | ||
| 46 | |||
| 47 | //FFScript FFCore; | ||
| 48 | extern FFScript FFCore; | ||
| 49 | extern ZModule zcm; | ||
| 50 | extern zcmodule moduledata; | ||
| 51 | extern uint8_t __isZQuest; | ||
| 52 | extern sprite_list guys, items, Ewpns, Lwpns, chainlinks, decorations; | ||
| 53 | extern particle_list particles; | ||
| 54 | extern void setZScriptVersion(int32_t s_version); | ||
| 55 | //FFSCript FFEngine; | ||
| 56 | |||
| 57 | static bool read_ext_zinfo = false, read_zinfo = false; | ||
| 58 | static bool loadquest_report = false; | ||
| 59 | static char const* loading_qst_name = NULL; | ||
| 60 | static byte loading_qst_num = 0; | ||
| 61 | static byte subscr_mode = ssdtMAX; | ||
| 62 | dword loading_tileset_flags = 0; | ||
| 63 | |||
| 64 | int32_t First[MAX_COMBO_COLS]={0},combo_alistpos[MAX_COMBO_COLS]={0},combo_pool_listpos[MAX_COMBO_COLS]={0},combo_auto_listpos[MAX_COMBO_COLS]={0}; | ||
| 65 | map_and_screen map_page[MAX_MAPPAGE_BTNS]= {{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0}}; | ||
| 66 | |||
| 67 | #ifdef _MSC_VER | ||
| 68 | #define strncasecmp _strnicmp | ||
| 69 | #endif | ||
| 70 | |||
| 71 | #ifndef _AL_MALLOC | ||
| 72 | #define _AL_MALLOC(a) _al_malloc(a) | ||
| 73 | #define _AL_FREE(a) _al_free(a) | ||
| 74 | #endif | ||
| 75 | |||
| 76 | using std::string; | ||
| 77 | using std::pair; | ||
| 78 | |||
| 79 | // extern bool debug; | ||
| 80 | extern int32_t hero_animation_speed; //lower is faster animation | ||
| 81 | extern byte *colordata; | ||
| 82 | //extern byte *tilebuf; | ||
| 83 | extern tiledata *newtilebuf; | ||
| 84 | extern byte *trashbuf; | ||
| 85 | extern itemdata *itemsbuf; | ||
| 86 | extern wpndata *wpnsbuf; | ||
| 87 | extern comboclass *combo_class_buf; | ||
| 88 | extern guydata *guysbuf; | ||
| 89 | extern ZCHEATS zcheats; | ||
| 90 | extern char palnames[MAXLEVELS][17]; | ||
| 91 | extern char *byte_conversion(int32_t number, int32_t format); | ||
| 92 | extern char *byte_conversion2(int32_t number1, int32_t number2, int32_t format1, int32_t format2); | ||
| 93 | string zScript; | ||
| 94 | 364 | std::map<int32_t, script_slot_data > ffcmap; | |
| 95 | 364 | std::map<int32_t, script_slot_data > globalmap; | |
| 96 | 364 | std::map<int32_t, script_slot_data > genericmap; | |
| 97 | 364 | std::map<int32_t, script_slot_data > itemmap; | |
| 98 | 364 | std::map<int32_t, script_slot_data > npcmap; | |
| 99 | 364 | std::map<int32_t, script_slot_data > ewpnmap; | |
| 100 | 364 | std::map<int32_t, script_slot_data > lwpnmap; | |
| 101 | 364 | std::map<int32_t, script_slot_data > playermap; | |
| 102 | 364 | std::map<int32_t, script_slot_data > dmapmap; | |
| 103 | 364 | std::map<int32_t, script_slot_data > screenmap; | |
| 104 | 364 | std::map<int32_t, script_slot_data > itemspritemap; | |
| 105 | 364 | std::map<int32_t, script_slot_data > comboscriptmap; | |
| 106 | 364 | std::map<int32_t, script_slot_data > subscreenmap; | |
| 107 | void free_newtilebuf(); | ||
| 108 | bool combosread=false; | ||
| 109 | bool mapsread=false; | ||
| 110 | bool fixffcs=false; | ||
| 111 | bool fixpolsvoice=false; | ||
| 112 | |||
| 113 | const std::string script_slot_data::DEFAULT_FORMAT = "%s %s"; | ||
| 114 | const std::string script_slot_data::INVALID_FORMAT = "%s --%s"; | ||
| 115 | const std::string script_slot_data::DISASSEMBLED_FORMAT = "%s ++%s"; | ||
| 116 | const std::string script_slot_data::ZASM_FORMAT = "%s ==%s"; | ||
| 117 | |||
| 118 | char qstdat_string[2048] = { 0 }; | ||
| 119 | |||
| 120 | static zinfo* load_tmp_zi = NULL; | ||
| 121 | |||
| 122 | int32_t memDBGwatch[8]= {0,0,0,0,0,0,0,0}; //So I can monitor memory crap | ||
| 123 | const byte clavio[9]={97,109,111,110,103,117,115,0}; | ||
| 124 | |||
| 125 | //enum { qe_OK, qe_notfound, qe_invalid, qe_version, qe_obsolete, | ||
| 126 | // qe_missing, qe_internal, qe_pwd, qe_match, qe_minver }; | ||
| 127 | |||
| 128 | const char *qst_error[] = | ||
| 129 | { | ||
| 130 | "OK","File not found","Invalid quest file", | ||
| 131 | "Version not supported","Obsolete version", | ||
| 132 | "Missing new data" , /* but let it pass in ZQuest */ | ||
| 133 | "Internal error occurred", "Invalid password", | ||
| 134 | "Quest title doesn't match saved game", "Save file is for older version of quest; please start new save", | ||
| 135 | "Out of memory", "File Debug Mode", "Canceled", "", "No quest assigned" | ||
| 136 | }; | ||
| 137 | |||
| 138 | //for legacy quests -DD | ||
| 139 | enum { ssiBOMB, ssiSWORD, ssiSHIELD, ssiCANDLE, ssiLETTER, ssiPOTION, ssiLETTERPOTION, ssiBOW, ssiARROW, ssiBOWANDARROW, ssiBAIT, ssiRING, ssiBRACELET, ssiMAP, | ||
| 140 | ssiCOMPASS, ssiBOSSKEY, ssiMAGICKEY, ssiBRANG, ssiWAND, ssiRAFT, ssiLADDER, ssiWHISTLE, ssiBOOK, ssiWALLET, ssiSBOMB, ssiHCPIECE, ssiAMULET, ssiFLIPPERS, | ||
| 141 | ssiHOOKSHOT, ssiLENS, ssiHAMMER, ssiBOOTS, ssiDIVINEFIRE, ssiDIVINEESCAPE, ssiDIVINEPROTECTION, ssiQUIVER, ssiBOMBBAG, ssiCBYRNA, ssiROCS, ssiHOVERBOOTS, | ||
| 142 | ssiSPINSCROLL, ssiCROSSSCROLL, ssiQUAKESCROLL, ssiWHISPRING, ssiCHARGERING, ssiPERILSCROLL, ssiWEALTHMEDAL, ssiHEARTRING, ssiMAGICRING, ssiSPINSCROLL2, | ||
| 143 | ssiQUAKESCROLL2, ssiAGONY, ssiSTOMPBOOTS, ssiWHIMSICALRING, ssiPERILRING, ssiMAX | ||
| 144 | }; | ||
| 145 | |||
| 146 | static byte deprecated_rules[QUESTRULES_NEW_SIZE]; | ||
| 147 | |||
| 148 | |||
| 149 | ✗ | char *byte_conversion(int32_t number, int32_t format) | |
| 150 | { | ||
| 151 | static char num_str[40]; | ||
| 152 | |||
| 153 | ✗ | if(format==-1) //auto | |
| 154 | { | ||
| 155 | ✗ | format=1; //bytes | |
| 156 | |||
| 157 | ✗ | if(number>1024) | |
| 158 | { | ||
| 159 | ✗ | format=2; //kilobytes | |
| 160 | ✗ | } | |
| 161 | |||
| 162 | ✗ | if(number>1024*1024) | |
| 163 | { | ||
| 164 | ✗ | format=3; //megabytes | |
| 165 | ✗ | } | |
| 166 | |||
| 167 | ✗ | if(number>1024*1024*1024) | |
| 168 | { | ||
| 169 | ✗ | format=4; //gigabytes (dude, what are you doing?) | |
| 170 | ✗ | } | |
| 171 | ✗ | } | |
| 172 | |||
| 173 | ✗ | switch(format) | |
| 174 | { | ||
| 175 | case 1: //bytes | ||
| 176 | ✗ | sprintf(num_str,"%db",number); | |
| 177 | ✗ | break; | |
| 178 | |||
| 179 | case 2: //kilobytes | ||
| 180 | ✗ | sprintf(num_str,"%.2fk",float(number)/1024); | |
| 181 | ✗ | break; | |
| 182 | |||
| 183 | case 3: //megabytes | ||
| 184 | ✗ | sprintf(num_str,"%.2fM",float(number)/(1024*1024)); | |
| 185 | ✗ | break; | |
| 186 | |||
| 187 | case 4: //gigabytes | ||
| 188 | ✗ | sprintf(num_str,"%.2fG",float(number)/(1024*1024*1024)); | |
| 189 | ✗ | break; | |
| 190 | |||
| 191 | default: | ||
| 192 | ✗ | abort(); | |
| 193 | break; | ||
| 194 | } | ||
| 195 | |||
| 196 | ✗ | return num_str; | |
| 197 | } | ||
| 198 | |||
| 199 | ✗ | char *byte_conversion2(int32_t number1, int32_t number2, int32_t format1, int32_t format2) | |
| 200 | { | ||
| 201 | static char num_str1[40]; | ||
| 202 | static char num_str2[40]; | ||
| 203 | static char num_str[80]; | ||
| 204 | |||
| 205 | ✗ | if(format1==-1) //auto | |
| 206 | { | ||
| 207 | ✗ | format1=1; //bytes | |
| 208 | |||
| 209 | ✗ | if(number1>1024) | |
| 210 | { | ||
| 211 | ✗ | format1=2; //kilobytes | |
| 212 | ✗ | } | |
| 213 | |||
| 214 | ✗ | if(number1>1024*1024) | |
| 215 | { | ||
| 216 | ✗ | format1=3; //megabytes | |
| 217 | ✗ | } | |
| 218 | |||
| 219 | ✗ | if(number1>1024*1024*1024) | |
| 220 | { | ||
| 221 | ✗ | format1=4; //gigabytes (dude, what are you doing?) | |
| 222 | ✗ | } | |
| 223 | ✗ | } | |
| 224 | |||
| 225 | ✗ | if(format2==-1) //auto | |
| 226 | { | ||
| 227 | ✗ | format2=1; //bytes | |
| 228 | |||
| 229 | ✗ | if(number2>1024) | |
| 230 | { | ||
| 231 | ✗ | format2=2; //kilobytes | |
| 232 | ✗ | } | |
| 233 | |||
| 234 | ✗ | if(number2>1024*1024) | |
| 235 | { | ||
| 236 | ✗ | format2=3; //megabytes | |
| 237 | ✗ | } | |
| 238 | |||
| 239 | ✗ | if(number2>1024*1024*1024) | |
| 240 | { | ||
| 241 | ✗ | format2=4; //gigabytes (dude, what are you doing?) | |
| 242 | ✗ | } | |
| 243 | ✗ | } | |
| 244 | |||
| 245 | ✗ | switch(format1) | |
| 246 | { | ||
| 247 | case 1: //bytes | ||
| 248 | ✗ | sprintf(num_str1,"%db",number1); | |
| 249 | ✗ | break; | |
| 250 | |||
| 251 | case 2: //kilobytes | ||
| 252 | ✗ | sprintf(num_str1,"%.2fk",float(number1)/1024); | |
| 253 | ✗ | break; | |
| 254 | |||
| 255 | case 3: //megabytes | ||
| 256 | ✗ | sprintf(num_str1,"%.2fM",float(number1)/(1024*1024)); | |
| 257 | ✗ | break; | |
| 258 | |||
| 259 | case 4: //gigabytes | ||
| 260 | ✗ | sprintf(num_str1,"%.2fG",float(number1)/(1024*1024*1024)); | |
| 261 | ✗ | break; | |
| 262 | |||
| 263 | default: | ||
| 264 | ✗ | abort(); | |
| 265 | break; | ||
| 266 | } | ||
| 267 | |||
| 268 | ✗ | switch(format2) | |
| 269 | { | ||
| 270 | case 1: //bytes | ||
| 271 | ✗ | sprintf(num_str2,"%db",number2); | |
| 272 | ✗ | break; | |
| 273 | |||
| 274 | case 2: //kilobytes | ||
| 275 | ✗ | sprintf(num_str2,"%.2fk",float(number2)/1024); | |
| 276 | ✗ | break; | |
| 277 | |||
| 278 | case 3: //megabytes | ||
| 279 | ✗ | sprintf(num_str2,"%.2fM",float(number2)/(1024*1024)); | |
| 280 | ✗ | break; | |
| 281 | |||
| 282 | case 4: //gigabytes | ||
| 283 | ✗ | sprintf(num_str2,"%.2fG",float(number2)/(1024*1024*1024)); | |
| 284 | ✗ | break; | |
| 285 | |||
| 286 | default: | ||
| 287 | ✗ | abort(); | |
| 288 | break; | ||
| 289 | } | ||
| 290 | |||
| 291 | ✗ | sprintf(num_str, "%s/%s", num_str1, num_str2); | |
| 292 | ✗ | return num_str; | |
| 293 | } | ||
| 294 | |||
| 295 | ✗ | char *ordinal(int32_t num) | |
| 296 | { | ||
| 297 | static const char *ending[4] = {"st","nd","rd","th"}; | ||
| 298 | static char ord_str[8]; | ||
| 299 | |||
| 300 | char *end; | ||
| 301 | ✗ | int32_t t=(num%100)/10; | |
| 302 | ✗ | int32_t n=num%10; | |
| 303 | |||
| 304 | ✗ | if(n>=1 && n<4 && t!=1) | |
| 305 | ✗ | end = (char *)ending[n-1]; | |
| 306 | else | ||
| 307 | ✗ | end = (char *)ending[3]; | |
| 308 | |||
| 309 | ✗ | sprintf(ord_str,"%d%s",num%10000,end); | |
| 310 | ✗ | return ord_str; | |
| 311 | } | ||
| 312 | |||
| 313 | ✗ | int32_t get_version_and_build(PACKFILE *f, word *version, word *build) | |
| 314 | { | ||
| 315 | int32_t ret; | ||
| 316 | ✗ | *version=0; | |
| 317 | ✗ | *build=0; | |
| 318 | ✗ | byte temp_map_count=map_count; | |
| 319 | byte temp_midi_flags[MIDIFLAGS_SIZE]; | ||
| 320 | ✗ | memcpy(temp_midi_flags, midi_flags, MIDIFLAGS_SIZE); | |
| 321 | |||
| 322 | zquestheader tempheader; | ||
| 323 | |||
| 324 | ✗ | if(!f) | |
| 325 | { | ||
| 326 | ✗ | return qe_invalid; | |
| 327 | } | ||
| 328 | |||
| 329 | ✗ | ret=readheader(f, &tempheader); | |
| 330 | |||
| 331 | ✗ | if(ret) | |
| 332 | { | ||
| 333 | ✗ | return ret; | |
| 334 | } | ||
| 335 | |||
| 336 | ✗ | map_count=temp_map_count; | |
| 337 | ✗ | memcpy(midi_flags, temp_midi_flags, MIDIFLAGS_SIZE); | |
| 338 | ✗ | *version=tempheader.zelda_version; | |
| 339 | ✗ | *build=tempheader.build; | |
| 340 | ✗ | return 0; | |
| 341 | ✗ | } | |
| 342 | |||
| 343 | |||
| 344 | ✗ | bool find_section(PACKFILE *f, int32_t section_id_requested) | |
| 345 | { | ||
| 346 | |||
| 347 | ✗ | if(!f) | |
| 348 | { | ||
| 349 | ✗ | return false; | |
| 350 | } | ||
| 351 | |||
| 352 | int32_t section_id_read; | ||
| 353 | ✗ | bool catchup=false; | |
| 354 | word dummy; | ||
| 355 | byte tempbyte; | ||
| 356 | char tempbuf[65536]; | ||
| 357 | |||
| 358 | |||
| 359 | ✗ | switch(section_id_requested) | |
| 360 | { | ||
| 361 | case ID_RULES: | ||
| 362 | case ID_STRINGS: | ||
| 363 | case ID_MISC: | ||
| 364 | case ID_TILES: | ||
| 365 | case ID_COMBOS: | ||
| 366 | case ID_CSETS: | ||
| 367 | case ID_MAPS: | ||
| 368 | case ID_DMAPS: | ||
| 369 | case ID_DOORS: | ||
| 370 | case ID_ITEMS: | ||
| 371 | case ID_WEAPONS: | ||
| 372 | case ID_COLORS: | ||
| 373 | case ID_ICONS: | ||
| 374 | case ID_INITDATA: | ||
| 375 | case ID_GUYS: | ||
| 376 | case ID_MIDIS: | ||
| 377 | case ID_CHEATS: | ||
| 378 | ✗ | break; | |
| 379 | |||
| 380 | default: | ||
| 381 | ✗ | al_trace("Bad section requested!\n"); | |
| 382 | ✗ | return false; | |
| 383 | break; | ||
| 384 | } | ||
| 385 | |||
| 386 | dword section_size; | ||
| 387 | |||
| 388 | //section id | ||
| 389 | ✗ | if(!p_mgetl(§ion_id_read,f)) | |
| 390 | { | ||
| 391 | ✗ | return false; | |
| 392 | } | ||
| 393 | |||
| 394 | ✗ | while(!pack_feof(f)) | |
| 395 | { | ||
| 396 | ✗ | switch(section_id_read) | |
| 397 | { | ||
| 398 | case ID_RULES: | ||
| 399 | case ID_STRINGS: | ||
| 400 | case ID_MISC: | ||
| 401 | case ID_TILES: | ||
| 402 | case ID_COMBOS: | ||
| 403 | case ID_CSETS: | ||
| 404 | case ID_MAPS: | ||
| 405 | case ID_DMAPS: | ||
| 406 | case ID_DOORS: | ||
| 407 | case ID_ITEMS: | ||
| 408 | case ID_WEAPONS: | ||
| 409 | case ID_COLORS: | ||
| 410 | case ID_ICONS: | ||
| 411 | case ID_INITDATA: | ||
| 412 | case ID_GUYS: | ||
| 413 | case ID_MIDIS: | ||
| 414 | case ID_CHEATS: | ||
| 415 | ✗ | catchup=false; | |
| 416 | ✗ | break; | |
| 417 | |||
| 418 | default: | ||
| 419 | ✗ | break; | |
| 420 | } | ||
| 421 | |||
| 422 | |||
| 423 | ✗ | while(catchup) | |
| 424 | { | ||
| 425 | //section id | ||
| 426 | ✗ | section_id_read=(section_id_read<<8); | |
| 427 | |||
| 428 | ✗ | if(!p_getc(&tempbyte,f)) | |
| 429 | { | ||
| 430 | ✗ | return false; | |
| 431 | } | ||
| 432 | |||
| 433 | ✗ | section_id_read+=tempbyte; | |
| 434 | } | ||
| 435 | |||
| 436 | ✗ | if(section_id_read==section_id_requested) | |
| 437 | { | ||
| 438 | ✗ | return true; | |
| 439 | } | ||
| 440 | else | ||
| 441 | { | ||
| 442 | //section version info | ||
| 443 | ✗ | if(!p_igetw(&dummy,f)) | |
| 444 | { | ||
| 445 | ✗ | return false; | |
| 446 | } | ||
| 447 | |||
| 448 | ✗ | if(!p_igetw(&dummy,f)) | |
| 449 | { | ||
| 450 | ✗ | return false; | |
| 451 | } | ||
| 452 | |||
| 453 | //section size | ||
| 454 | ✗ | if(!p_igetl(§ion_size,f)) | |
| 455 | { | ||
| 456 | ✗ | return false; | |
| 457 | } | ||
| 458 | |||
| 459 | //pack_fseek(f, section_size); | ||
| 460 | ✗ | while(section_size>65535) | |
| 461 | { | ||
| 462 | ✗ | pfread(tempbuf,65535,f); | |
| 463 | ✗ | tempbuf[65535]=0; | |
| 464 | ✗ | section_size-=65535; | |
| 465 | } | ||
| 466 | |||
| 467 | ✗ | if(section_size>0) | |
| 468 | { | ||
| 469 | ✗ | pfread(tempbuf,section_size,f); | |
| 470 | ✗ | tempbuf[section_size]=0; | |
| 471 | ✗ | } | |
| 472 | } | ||
| 473 | |||
| 474 | //section id | ||
| 475 | ✗ | if(!p_mgetl(§ion_id_read,f)) | |
| 476 | { | ||
| 477 | ✗ | return false; | |
| 478 | } | ||
| 479 | } | ||
| 480 | |||
| 481 | ✗ | return false; | |
| 482 | ✗ | } | |
| 483 | |||
| 484 | |||
| 485 | |||
| 486 | |||
| 487 | |||
| 488 | ✗ | bool valid_zqt(PACKFILE *f) | |
| 489 | { | ||
| 490 | |||
| 491 | //word tiles_used; | ||
| 492 | //word combos_used; | ||
| 493 | //open the file | ||
| 494 | //PACKFILE *f = pack_fopen(path, F_READ_PACKED); | ||
| 495 | ✗ | if(!f) | |
| 496 | ✗ | return false; | |
| 497 | |||
| 498 | //for now, everything else is valid | ||
| 499 | ✗ | return true; | |
| 500 | |||
| 501 | /*int16_t version; | ||
| 502 | byte build; | ||
| 503 | |||
| 504 | //read the version and make sure it worked | ||
| 505 | if(!p_igetw(&version,f)) | ||
| 506 | { | ||
| 507 | goto error; | ||
| 508 | } | ||
| 509 | |||
| 510 | //read the build and make sure it worked | ||
| 511 | if(!p_getc(&build,f)) | ||
| 512 | goto error; | ||
| 513 | |||
| 514 | //read the tile info and make sure it worked | ||
| 515 | if(!p_igetw(&tiles_used,f)) | ||
| 516 | { | ||
| 517 | goto error; | ||
| 518 | } | ||
| 519 | |||
| 520 | for (int32_t i=0; i<tiles_used; i++) | ||
| 521 | { | ||
| 522 | if(!pfread(trashbuf,tilesize(tf4Bit),f)) | ||
| 523 | { | ||
| 524 | goto error; | ||
| 525 | } | ||
| 526 | } | ||
| 527 | |||
| 528 | //read the combo info and make sure it worked | ||
| 529 | if(!p_igetw(&combos_used,f)) | ||
| 530 | { | ||
| 531 | goto error; | ||
| 532 | } | ||
| 533 | for (int32_t i=0; i<combos_used; i++) | ||
| 534 | { | ||
| 535 | if(!pfread(trashbuf,sizeof(newcombo),f)) | ||
| 536 | { | ||
| 537 | goto error; | ||
| 538 | } | ||
| 539 | } | ||
| 540 | |||
| 541 | //read the palette info and make sure it worked | ||
| 542 | for (int32_t i=0; i<48; i++) | ||
| 543 | { | ||
| 544 | if(!pfread(trashbuf,newpdTOTAL,f)) | ||
| 545 | { | ||
| 546 | goto error; | ||
| 547 | } | ||
| 548 | } | ||
| 549 | if(!pfread(trashbuf,sizeof(palcycle)*256*3,f)) | ||
| 550 | { | ||
| 551 | goto error; | ||
| 552 | } | ||
| 553 | for (int32_t i=0; i<MAXLEVELS; i++) | ||
| 554 | { | ||
| 555 | if(!pfread(trashbuf,PALNAMESIZE,f)) | ||
| 556 | { | ||
| 557 | goto error; | ||
| 558 | } | ||
| 559 | } | ||
| 560 | |||
| 561 | //read the sprite info and make sure it worked | ||
| 562 | for (int32_t i=0; i<MAXITEMS; i++) | ||
| 563 | { | ||
| 564 | if(!pfread(trashbuf,sizeof(itemdata),f)) | ||
| 565 | { | ||
| 566 | goto error; | ||
| 567 | } | ||
| 568 | } | ||
| 569 | |||
| 570 | for (int32_t i=0; i<MAXWPNS; i++) | ||
| 571 | { | ||
| 572 | if(!pfread(trashbuf,sizeof(wpndata),f)) | ||
| 573 | { | ||
| 574 | goto error; | ||
| 575 | } | ||
| 576 | } | ||
| 577 | |||
| 578 | //read the triforce pieces info and make sure it worked | ||
| 579 | for (int32_t i=0; i<8; ++i) | ||
| 580 | { | ||
| 581 | if(!p_getc(&trashbuf,f)) | ||
| 582 | { | ||
| 583 | goto error; | ||
| 584 | } | ||
| 585 | } | ||
| 586 | |||
| 587 | |||
| 588 | |||
| 589 | //read the game icons info and make sure it worked | ||
| 590 | for (int32_t i=0; i<4; ++i) | ||
| 591 | { | ||
| 592 | if(!p_igetw(&trashbuf,f)) | ||
| 593 | { | ||
| 594 | goto error; | ||
| 595 | } | ||
| 596 | } | ||
| 597 | |||
| 598 | //read the misc colors info and map styles info and make sure it worked | ||
| 599 | if(!pfread(trashbuf,sizeof(zcolors),f)) | ||
| 600 | { | ||
| 601 | goto error; | ||
| 602 | } | ||
| 603 | |||
| 604 | //read the template screens and make sure it worked | ||
| 605 | byte num_maps; | ||
| 606 | if(!p_getc(&num_maps,f)) | ||
| 607 | { | ||
| 608 | goto error; | ||
| 609 | } | ||
| 610 | for (int32_t i=0; i<TEMPLATES; i++) | ||
| 611 | { | ||
| 612 | if(!pfread(trashbuf,sizeof(mapscr),f)) | ||
| 613 | { | ||
| 614 | goto error; | ||
| 615 | } | ||
| 616 | } | ||
| 617 | if (num_maps>1) //dungeon templates | ||
| 618 | { | ||
| 619 | for (int32_t i=0; i<TEMPLATES; i++) | ||
| 620 | { | ||
| 621 | if(!pfread(trashbuf,sizeof(mapscr),f)) | ||
| 622 | { | ||
| 623 | goto error; | ||
| 624 | } | ||
| 625 | } | ||
| 626 | } | ||
| 627 | |||
| 628 | //yay! it worked! close the file and say everything was ok. | ||
| 629 | pack_fclose(f); | ||
| 630 | return true; | ||
| 631 | |||
| 632 | error: | ||
| 633 | pack_fclose(f); | ||
| 634 | return false;*/ | ||
| 635 | ✗ | } | |
| 636 | |||
| 637 | ✗ | bool valid_zqt(const char *filename) | |
| 638 | { | ||
| 639 | ✗ | PACKFILE *f=NULL; | |
| 640 | bool isvalid; | ||
| 641 | int32_t error; | ||
| 642 | ✗ | f=open_quest_file(&error, filename, false); | |
| 643 | |||
| 644 | ✗ | if(!f) | |
| 645 | { | ||
| 646 | // setPackfilePassword(NULL); | ||
| 647 | ✗ | return false; | |
| 648 | } | ||
| 649 | |||
| 650 | ✗ | isvalid=valid_zqt(f); | |
| 651 | |||
| 652 | ✗ | clear_quest_tmpfile(); | |
| 653 | ✗ | pack_fclose(f); | |
| 654 | |||
| 655 | // setPackfilePassword(NULL); | ||
| 656 | ✗ | return isvalid; | |
| 657 | ✗ | } | |
| 658 | |||
| 659 | /* | ||
| 660 | .qst file history | ||
| 661 | |||
| 662 | .qst files have always been compressed using allegro's packfiles. | ||
| 663 | |||
| 664 | At some point, an encoding layer was added. The two layers look like this: | ||
| 665 | |||
| 666 | 1) The top layer is from us. See decode_file_007. | ||
| 667 | [0-24] Preamble "Zelda Classic Quest File" | ||
| 668 | [25-28] Initial decoding seed value. | ||
| 669 | [29-X] Allegro-compressed payload (AKA "packed" file), but XOR'd based on seed value | ||
| 670 | [last 4] Checksum | ||
| 671 | |||
| 672 | 2) The bottom layer is a "compressed packed file" from Allegro 4. The entire payload | ||
| 673 | is XOR'd with a password (datapwd). Once that is undone, the first four bytes are "slh!", | ||
| 674 | followed by a lzss compressed representation of the payload (from allergo' packfile compression). | ||
| 675 | The oldest quests skip the password part. | ||
| 676 | |||
| 677 | Simply, the job of this function is to peel away the top layer. | ||
| 678 | |||
| 679 | With this second layer of encryption, the data isn't any more secure, and adds a significant delay | ||
| 680 | in opening and saving files. There is no version field, so they decryption key is | ||
| 681 | found via trial-by-error (very slow!) | ||
| 682 | |||
| 683 | There are other file types of interest: | ||
| 684 | - .zqt: quest template files, skips top-layer encryption pass | ||
| 685 | - .qsu: "unencoded" (and uncompressed) files; skips encryption and compression (also makes the longtan password moot) | ||
| 686 | - .qu?: same as above. automated backup files | ||
| 687 | - .qb?: same as above. automated backup files | ||
| 688 | - .qt?: compressed and encrypted (or not encrypted, as of May 2023) | ||
| 689 | |||
| 690 | May 2023: .qst files are now saved without the top layer encoding, and no allegro packfile password. The first bytes of these | ||
| 691 | files are now "slh!.AG ZC Enhanced Quest File". | ||
| 692 | The following command will take an existing qst file and upgrade it: `./zquest -unencrypt-qst <input> <output>` | ||
| 693 | */ | ||
| 694 | 695 | PACKFILE *open_quest_file(int32_t *open_error, const char *filename, bool show_progress) | |
| 695 | { | ||
| 696 |
2/2✓ Branch 0 taken 694 times.
✓ Branch 1 taken 1 times.
|
695 | if (show_progress) |
| 697 | { | ||
| 698 | 1 | box_start(1, "Loading Quest", get_zc_font(font_lfont), font, true); | |
| 699 | 1 | } | |
| 700 | |||
| 701 | 695 | auto unencrypted_result = try_open_maybe_legacy_encoded_file(filename, ENC_STR, nullptr, QH_NEWIDSTR, QH_IDSTR); | |
| 702 |
2/2✓ Branch 0 taken 535 times.
✓ Branch 1 taken 160 times.
|
695 | if (unencrypted_result.decoded_pf) |
| 703 | 535 | return unencrypted_result.decoded_pf; | |
| 704 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 160 times.
|
160 | if (unencrypted_result.not_found) |
| 705 | { | ||
| 706 | ✗ | *open_error = qe_notfound; | |
| 707 | ✗ | return nullptr; | |
| 708 | } | ||
| 709 | |||
| 710 | // Everything below here is legacy code - recently saved quest files will have | ||
| 711 | // returned by now. | ||
| 712 | // The only replay qst file that is still using this legacy encoding is `link_to_the_zelda.qst`. | ||
| 713 | |||
| 714 | // Note: although this is primarily for loading .qst files, it can also handle all of the | ||
| 715 | // file types mentioned in the comment above. No need to be told if the file being loaded | ||
| 716 | // is encrypted or compressed, we can do some simple and fast checks to determine how to load it. | ||
| 717 | 160 | bool top_layer_compressed = unencrypted_result.top_layer_compressed; | |
| 718 | 160 | bool compressed = unencrypted_result.compressed; | |
| 719 | 160 | bool encrypted = unencrypted_result.encrypted; | |
| 720 | |||
| 721 | char tmpfilename[L_tmpnam]; | ||
| 722 | 160 | temp_name(tmpfilename); | |
| 723 | char percent_done[30]; | ||
| 724 | 160 | int32_t current_method=0; | |
| 725 | |||
| 726 | PACKFILE *f; | ||
| 727 | 160 | const char *passwd= encrypted ? datapwd : ""; | |
| 728 | |||
| 729 | // oldquest flag is set when an unencrypted qst file is suspected. | ||
| 730 | 160 | bool oldquest = false; | |
| 731 | int32_t ret; | ||
| 732 | |||
| 733 |
1/2✓ Branch 0 taken 160 times.
✗ Branch 1 not taken.
|
160 | if(strcmp(filename, "default.qst")!=0) |
| 734 | { | ||
| 735 | 160 | box_out(filename); | |
| 736 | 160 | } | |
| 737 | else | ||
| 738 | { | ||
| 739 | ✗ | box_out("new quest"); // Or whatever | |
| 740 | } | ||
| 741 | 160 | box_out("..."); | |
| 742 | 160 | box_eol(); | |
| 743 | 160 | box_eol(); | |
| 744 | |||
| 745 |
1/2✓ Branch 0 taken 160 times.
✗ Branch 1 not taken.
|
160 | if(encrypted) |
| 746 | { | ||
| 747 | 160 | box_out("Decrypting..."); | |
| 748 | 160 | box_save_x(); | |
| 749 | 160 | ret = decode_file_007(filename, tmpfilename, ENC_STR, ENC_METHOD_MAX-1, top_layer_compressed, passwd); | |
| 750 | |||
| 751 |
2/2✓ Branch 0 taken 97 times.
✓ Branch 1 taken 63 times.
|
160 | if(ret) |
| 752 | { | ||
| 753 |
1/3✓ Branch 0 taken 63 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
|
63 | switch(ret) |
| 754 | { | ||
| 755 | case 1: | ||
| 756 | ✗ | box_out("error."); | |
| 757 | ✗ | box_eol(); | |
| 758 | ✗ | box_end(true); | |
| 759 | ✗ | *open_error=qe_notfound; | |
| 760 | ✗ | return NULL; | |
| 761 | |||
| 762 | case 2: | ||
| 763 | ✗ | box_out("error."); | |
| 764 | ✗ | box_eol(); | |
| 765 | ✗ | box_end(true); | |
| 766 | ✗ | *open_error=qe_internal; | |
| 767 | ✗ | return NULL; | |
| 768 | // be sure not to delete tmpfilename now... | ||
| 769 | } | ||
| 770 | |||
| 771 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 63 times.
|
63 | if(ret==5) //old encryption? |
| 772 | { | ||
| 773 | 63 | current_method++; | |
| 774 | 63 | sprintf(percent_done, "%d%%", (current_method*100)/ENC_METHOD_MAX); | |
| 775 | 63 | box_out(percent_done); | |
| 776 | 63 | box_load_x(); | |
| 777 | 63 | ret = decode_file_007(filename, tmpfilename, ENC_STR, ENC_METHOD_211B9, strstr(filename, ".dat#")!=NULL, passwd); | |
| 778 | 63 | } | |
| 779 | |||
| 780 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 63 times.
|
63 | if(ret==5) //old encryption? |
| 781 | { | ||
| 782 | 63 | current_method++; | |
| 783 | 63 | sprintf(percent_done, "%d%%", (current_method*100)/ENC_METHOD_MAX); | |
| 784 | 63 | box_out(percent_done); | |
| 785 | 63 | box_load_x(); | |
| 786 | 63 | ret = decode_file_007(filename, tmpfilename, ENC_STR, ENC_METHOD_192B185, strstr(filename, ".dat#")!=NULL, passwd); | |
| 787 | 63 | } | |
| 788 | |||
| 789 |
2/2✓ Branch 0 taken 45 times.
✓ Branch 1 taken 18 times.
|
63 | if(ret==5) //old encryption? |
| 790 | { | ||
| 791 | 18 | current_method++; | |
| 792 | 18 | sprintf(percent_done, "%d%%", (current_method*100)/ENC_METHOD_MAX); | |
| 793 | 18 | box_out(percent_done); | |
| 794 | 18 | box_load_x(); | |
| 795 | 18 | ret = decode_file_007(filename, tmpfilename, ENC_STR, ENC_METHOD_192B105, strstr(filename, ".dat#")!=NULL, passwd); | |
| 796 | 18 | } | |
| 797 | |||
| 798 |
2/2✓ Branch 0 taken 51 times.
✓ Branch 1 taken 12 times.
|
63 | if(ret==5) //old encryption? |
| 799 | { | ||
| 800 | 12 | current_method++; | |
| 801 | 12 | sprintf(percent_done, "%d%%", (current_method*100)/ENC_METHOD_MAX); | |
| 802 | 12 | box_out(percent_done); | |
| 803 | 12 | box_load_x(); | |
| 804 | 12 | ret = decode_file_007(filename, tmpfilename, ENC_STR, ENC_METHOD_192B104, strstr(filename, ".dat#")!=NULL, passwd); | |
| 805 | 12 | } | |
| 806 | |||
| 807 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 63 times.
|
63 | if(ret) |
| 808 | { | ||
| 809 | ✗ | oldquest = true; | |
| 810 | ✗ | passwd=""; | |
| 811 | ✗ | } | |
| 812 | 63 | } | |
| 813 | |||
| 814 | 160 | box_out("okay."); | |
| 815 | 160 | box_eol(); | |
| 816 | 160 | } | |
| 817 | else | ||
| 818 | { | ||
| 819 | ✗ | oldquest = true; | |
| 820 | } | ||
| 821 | |||
| 822 | 160 | box_out("Opening..."); | |
| 823 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 160 times.
|
160 | f = pack_fopen_password(oldquest ? filename : tmpfilename, compressed ? F_READ_PACKED : F_READ, passwd); |
| 824 |
1/2✓ Branch 0 taken 160 times.
✗ Branch 1 not taken.
|
160 | if(!f) |
| 825 | { | ||
| 826 | ✗ | if((compressed==1)&&(errno==EDOM)) | |
| 827 | { | ||
| 828 | ✗ | f = pack_fopen_password(oldquest ? filename : tmpfilename, F_READ, passwd); | |
| 829 | ✗ | } | |
| 830 | |||
| 831 | ✗ | if(!f) | |
| 832 | { | ||
| 833 | ✗ | if(!oldquest) | |
| 834 | { | ||
| 835 | ✗ | delete_file(tmpfilename); | |
| 836 | ✗ | } | |
| 837 | ✗ | box_out("error."); | |
| 838 | ✗ | box_eol(); | |
| 839 | ✗ | box_end(true); | |
| 840 | ✗ | *open_error=qe_invalid; | |
| 841 | ✗ | return NULL; | |
| 842 | } | ||
| 843 | ✗ | } | |
| 844 | |||
| 845 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 160 times.
|
160 | if(!oldquest) |
| 846 | { | ||
| 847 | 160 | delete_file(tmpfilename); | |
| 848 | 160 | } | |
| 849 | |||
| 850 | 160 | box_out("okay."); | |
| 851 | 160 | box_eol(); | |
| 852 | |||
| 853 | 160 | return f; | |
| 854 | 695 | } | |
| 855 | |||
| 856 | ✗ | PACKFILE *open_quest_template(zquestheader *Header, char *deletefilename, bool validate) | |
| 857 | { | ||
| 858 | char *filename; | ||
| 859 | ✗ | PACKFILE *f=NULL; | |
| 860 | ✗ | int32_t open_error=0; | |
| 861 | |||
| 862 | ✗ | strcpy(qstdat_string, "modules/classic/default.qst"); | |
| 863 | ✗ | if(Header->templatepath[0]==0) | |
| 864 | { | ||
| 865 | ✗ | filename=(char *)malloc(2048); | |
| 866 | ✗ | strcpy(filename, qstdat_string); | |
| 867 | ✗ | } | |
| 868 | else | ||
| 869 | { | ||
| 870 | // TODO: should be safe to remove this, no one seems to use custom quest templates. | ||
| 871 | ✗ | filename=Header->templatepath; | |
| 872 | } | ||
| 873 | |||
| 874 | ✗ | f=open_quest_file(&open_error, filename, false); | |
| 875 | |||
| 876 | ✗ | if(Header->templatepath[0]==0) | |
| 877 | { | ||
| 878 | ✗ | free(filename); | |
| 879 | ✗ | } | |
| 880 | |||
| 881 | ✗ | if(!f) | |
| 882 | { | ||
| 883 | ✗ | return NULL; | |
| 884 | } | ||
| 885 | |||
| 886 | ✗ | if(validate) | |
| 887 | { | ||
| 888 | ✗ | if(!valid_zqt(f)) | |
| 889 | { | ||
| 890 | ✗ | jwin_alert("Error","Invalid Quest Template",NULL,NULL,"O&K",NULL,'k',0,get_zc_font(font_lfont)); | |
| 891 | ✗ | pack_fclose(f); | |
| 892 | ✗ | clear_quest_tmpfile(); | |
| 893 | ✗ | return NULL; | |
| 894 | } | ||
| 895 | ✗ | } | |
| 896 | |||
| 897 | ✗ | return f; | |
| 898 | ✗ | } | |
| 899 | |||
| 900 | ✗ | bool init_section(zquestheader *Header, int32_t section_id, miscQdata *Misc, zctune *tunes, bool validate) | |
| 901 | { | ||
| 902 | // We absolutely do not support loading from a template file to initialize data outside the editor. | ||
| 903 | // TODO: move this code into zq/ | ||
| 904 | ✗ | if (get_app_id() != App::zquest) return false; | |
| 905 | |||
| 906 | ✗ | combosread=false; | |
| 907 | ✗ | mapsread=false; | |
| 908 | ✗ | fixffcs=false; | |
| 909 | |||
| 910 | ✗ | switch(section_id) | |
| 911 | { | ||
| 912 | case ID_RULES: | ||
| 913 | case ID_STRINGS: | ||
| 914 | case ID_MISC: | ||
| 915 | case ID_TILES: | ||
| 916 | case ID_COMBOS: | ||
| 917 | case ID_CSETS: | ||
| 918 | case ID_MAPS: | ||
| 919 | case ID_DMAPS: | ||
| 920 | case ID_DOORS: | ||
| 921 | case ID_ITEMS: | ||
| 922 | case ID_WEAPONS: | ||
| 923 | case ID_COLORS: | ||
| 924 | case ID_ICONS: | ||
| 925 | case ID_INITDATA: | ||
| 926 | case ID_GUYS: | ||
| 927 | case ID_MIDIS: | ||
| 928 | case ID_CHEATS: | ||
| 929 | case ID_ITEMDROPSETS: | ||
| 930 | case ID_FAVORITES: | ||
| 931 | ✗ | break; | |
| 932 | |||
| 933 | default: | ||
| 934 | ✗ | return false; | |
| 935 | break; | ||
| 936 | } | ||
| 937 | |||
| 938 | int32_t ret; | ||
| 939 | word version, build; | ||
| 940 | ✗ | PACKFILE *f=NULL; | |
| 941 | |||
| 942 | char deletefilename[1024]; | ||
| 943 | ✗ | deletefilename[0]=0; | |
| 944 | |||
| 945 | //why is this here? | ||
| 946 | /* | ||
| 947 | if(colordata==NULL) | ||
| 948 | return false; | ||
| 949 | */ | ||
| 950 | |||
| 951 | //setPackfilePassword(datapwd); | ||
| 952 | ✗ | f=open_quest_template(Header, deletefilename, validate); | |
| 953 | |||
| 954 | ✗ | if(!f) //no file, nothing to delete | |
| 955 | { | ||
| 956 | // setPackfilePassword(NULL); | ||
| 957 | ✗ | return false; | |
| 958 | } | ||
| 959 | |||
| 960 | ✗ | ret=get_version_and_build(f, &version, &build); | |
| 961 | |||
| 962 | ✗ | if(ret||(version==0)) | |
| 963 | { | ||
| 964 | ✗ | pack_fclose(f); | |
| 965 | ✗ | clear_quest_tmpfile(); | |
| 966 | |||
| 967 | ✗ | if(deletefilename[0]) | |
| 968 | { | ||
| 969 | ✗ | delete_file(deletefilename); | |
| 970 | ✗ | } | |
| 971 | |||
| 972 | // setPackfilePassword(NULL); | ||
| 973 | ✗ | return false; | |
| 974 | } | ||
| 975 | |||
| 976 | ✗ | if(!find_section(f, section_id)) | |
| 977 | { | ||
| 978 | ✗ | al_trace("Can't find section!\n"); | |
| 979 | ✗ | pack_fclose(f); | |
| 980 | ✗ | clear_quest_tmpfile(); | |
| 981 | |||
| 982 | ✗ | if(deletefilename[0]) | |
| 983 | { | ||
| 984 | ✗ | delete_file(deletefilename); | |
| 985 | ✗ | } | |
| 986 | |||
| 987 | //setPackfilePassword(NULL); | ||
| 988 | ✗ | return false; | |
| 989 | } | ||
| 990 | |||
| 991 | ✗ | switch(section_id) | |
| 992 | { | ||
| 993 | case ID_RULES: | ||
| 994 | //rules | ||
| 995 | ✗ | ret=readrules(f, Header); | |
| 996 | ✗ | break; | |
| 997 | |||
| 998 | case ID_STRINGS: | ||
| 999 | //strings | ||
| 1000 | ✗ | ret=readstrings(f, Header); | |
| 1001 | ✗ | break; | |
| 1002 | |||
| 1003 | case ID_MISC: | ||
| 1004 | //misc data | ||
| 1005 | ✗ | ret=readmisc(f, Header, Misc); | |
| 1006 | ✗ | break; | |
| 1007 | |||
| 1008 | case ID_TILES: | ||
| 1009 | //tiles | ||
| 1010 | ✗ | ret=readtiles(f, newtilebuf, Header, version, build, 0, NEWMAXTILES, true); | |
| 1011 | ✗ | break; | |
| 1012 | |||
| 1013 | case ID_COMBOS: | ||
| 1014 | //combos | ||
| 1015 | ✗ | clear_combos(); | |
| 1016 | ✗ | ret=readcombos(f, Header, version, build, 0, MAXCOMBOS); | |
| 1017 | ✗ | combosread=true; | |
| 1018 | ✗ | break; | |
| 1019 | |||
| 1020 | case ID_COMBOALIASES: | ||
| 1021 | //combos | ||
| 1022 | ✗ | ret=readcomboaliases(f, Header, version, build); | |
| 1023 | ✗ | break; | |
| 1024 | |||
| 1025 | case ID_CSETS: | ||
| 1026 | //color data | ||
| 1027 | ✗ | ret=readcolordata(f, Misc, version, build, 0, newerpdTOTAL); | |
| 1028 | ✗ | break; | |
| 1029 | |||
| 1030 | case ID_MAPS: | ||
| 1031 | //maps | ||
| 1032 | ✗ | ret=readmaps(f, Header); | |
| 1033 | ✗ | mapsread=true; | |
| 1034 | ✗ | break; | |
| 1035 | |||
| 1036 | case ID_DMAPS: | ||
| 1037 | //dmaps | ||
| 1038 | ✗ | ret=readdmaps(f, Header, version, build, 0, MAXDMAPS); | |
| 1039 | ✗ | break; | |
| 1040 | |||
| 1041 | case ID_DOORS: | ||
| 1042 | //door combo sets | ||
| 1043 | ✗ | ret=readdoorcombosets(f, Header); | |
| 1044 | ✗ | break; | |
| 1045 | |||
| 1046 | case ID_ITEMS: | ||
| 1047 | //items | ||
| 1048 | ✗ | ret=readitems(f, version, build); | |
| 1049 | ✗ | break; | |
| 1050 | |||
| 1051 | case ID_WEAPONS: | ||
| 1052 | //weapons | ||
| 1053 | ✗ | ret=readweapons(f, Header); | |
| 1054 | ✗ | break; | |
| 1055 | |||
| 1056 | case ID_COLORS: | ||
| 1057 | //misc. colors | ||
| 1058 | ✗ | ret=readmisccolors(f, Header, Misc); | |
| 1059 | ✗ | break; | |
| 1060 | |||
| 1061 | case ID_ICONS: | ||
| 1062 | //game icons | ||
| 1063 | ✗ | ret=readgameicons(f, Header, Misc); | |
| 1064 | ✗ | break; | |
| 1065 | |||
| 1066 | case ID_INITDATA: | ||
| 1067 | //initialization data | ||
| 1068 | ✗ | ret=readinitdata(f, Header); | |
| 1069 | ✗ | break; | |
| 1070 | |||
| 1071 | case ID_GUYS: | ||
| 1072 | //guys | ||
| 1073 | ✗ | ret=readguys(f, Header); | |
| 1074 | ✗ | break; | |
| 1075 | |||
| 1076 | case ID_MIDIS: | ||
| 1077 | //midis | ||
| 1078 | ✗ | ret=readtunes(f, Header, tunes); | |
| 1079 | ✗ | break; | |
| 1080 | |||
| 1081 | case ID_CHEATS: | ||
| 1082 | //cheat codes | ||
| 1083 | ✗ | ret=readcheatcodes(f, Header); | |
| 1084 | ✗ | break; | |
| 1085 | |||
| 1086 | case ID_ITEMDROPSETS: | ||
| 1087 | //item drop sets | ||
| 1088 | // Why is this one commented out? | ||
| 1089 | //ret=readitemdropsets(f, (int32_t)version, (word)build); | ||
| 1090 | ✗ | break; | |
| 1091 | |||
| 1092 | case ID_FAVORITES: | ||
| 1093 | // favorite combos and aliases | ||
| 1094 | ✗ | ret=readfavorites(f, version, build); | |
| 1095 | ✗ | break; | |
| 1096 | |||
| 1097 | default: | ||
| 1098 | ✗ | ret=-1; | |
| 1099 | ✗ | break; | |
| 1100 | } | ||
| 1101 | |||
| 1102 | ✗ | pack_fclose(f); | |
| 1103 | ✗ | clear_quest_tmpfile(); | |
| 1104 | |||
| 1105 | ✗ | if(deletefilename[0]) | |
| 1106 | { | ||
| 1107 | ✗ | delete_file(deletefilename); | |
| 1108 | ✗ | } | |
| 1109 | |||
| 1110 | //setPackfilePassword(NULL); | ||
| 1111 | ✗ | if(!ret) | |
| 1112 | { | ||
| 1113 | ✗ | return true; | |
| 1114 | } | ||
| 1115 | |||
| 1116 | ✗ | return false; | |
| 1117 | ✗ | } | |
| 1118 | |||
| 1119 | ✗ | bool init_tiles(bool validate, zquestheader *Header) | |
| 1120 | { | ||
| 1121 | ✗ | return init_section(Header, ID_TILES, NULL, NULL, validate); | |
| 1122 | } | ||
| 1123 | |||
| 1124 | ✗ | bool init_combos(bool validate, zquestheader *Header) | |
| 1125 | { | ||
| 1126 | ✗ | return init_section(Header, ID_COMBOS, NULL, NULL, validate); | |
| 1127 | } | ||
| 1128 | |||
| 1129 | ✗ | bool init_colordata(bool validate, zquestheader *Header, miscQdata *Misc) | |
| 1130 | { | ||
| 1131 | ✗ | return init_section(Header, ID_CSETS, Misc, NULL, validate); | |
| 1132 | } | ||
| 1133 | |||
| 1134 | 695 | void init_spritelists() | |
| 1135 | { | ||
| 1136 |
2/2✓ Branch 0 taken 272 times.
✓ Branch 1 taken 423 times.
|
695 | if(FFCore.quest_format[vZelda] < 0x255) |
| 1137 | { | ||
| 1138 | 272 | guys.setMax(255); | |
| 1139 | 272 | items.setMax(255); | |
| 1140 | 272 | Ewpns.setMax(255); | |
| 1141 | 272 | Lwpns.setMax(255); | |
| 1142 | 272 | chainlinks.setMax(255); | |
| 1143 | 272 | decorations.setMax(255); | |
| 1144 | 272 | particles.setMax(255); | |
| 1145 | 272 | } | |
| 1146 | else | ||
| 1147 | { | ||
| 1148 | 423 | guys.setMax(255); | |
| 1149 | 423 | items.setMax(255); | |
| 1150 | 423 | Ewpns.setMax(255); | |
| 1151 | 423 | Lwpns.setMax(255); | |
| 1152 | 423 | chainlinks.setMax(255); | |
| 1153 | 423 | decorations.setMax(255); | |
| 1154 | 423 | particles.setMax(255*((255*4)+1)); //255 per sprite that can use particles; guys, items, ewpns, lwpns, +HERO | |
| 1155 | } | ||
| 1156 | 695 | } | |
| 1157 | |||
| 1158 | 266 | bool reset_items(bool validate, zquestheader *Header) | |
| 1159 | { | ||
| 1160 | 266 | bool ret = true; | |
| 1161 |
1/2✓ Branch 0 taken 266 times.
✗ Branch 1 not taken.
|
266 | if (get_app_id() == App::zquest) |
| 1162 | ✗ | ret = init_section(Header, ID_ITEMS, NULL, NULL, validate); | |
| 1163 | |||
| 1164 |
2/2✓ Branch 0 taken 266 times.
✓ Branch 1 taken 68096 times.
|
68362 | for(int32_t i=0; i<MAXITEMS; i++) reset_itemname(i); |
| 1165 | |||
| 1166 | 266 | return ret; | |
| 1167 | } | ||
| 1168 | |||
| 1169 | ✗ | bool reset_guys() | |
| 1170 | { | ||
| 1171 | // The .dat file's guys definitions are always synchronised with defdata.cpp's - even the tile settings. | ||
| 1172 | ✗ | init_guys(V_GUYS); | |
| 1173 | ✗ | return true; | |
| 1174 | } | ||
| 1175 | |||
| 1176 | ✗ | bool reset_wpns(bool validate, zquestheader *Header) | |
| 1177 | { | ||
| 1178 | ✗ | bool ret = true; | |
| 1179 | ✗ | if (get_app_id() == App::zquest) | |
| 1180 | ✗ | ret = init_section(Header, ID_WEAPONS, NULL, NULL, validate); | |
| 1181 | |||
| 1182 | ✗ | for(int32_t i=0; i<MAXWPNS; i++) | |
| 1183 | ✗ | reset_weaponname(i); | |
| 1184 | |||
| 1185 | ✗ | return ret; | |
| 1186 | } | ||
| 1187 | |||
| 1188 | ✗ | bool reset_mapstyles(bool validate, miscQdata *Misc) | |
| 1189 | { | ||
| 1190 | ✗ | Misc->colors.blueframe_tile = 20044; | |
| 1191 | ✗ | Misc->colors.blueframe_cset = 0; | |
| 1192 | ✗ | Misc->colors.triforce_tile = 23461; | |
| 1193 | ✗ | Misc->colors.triforce_cset = 1; | |
| 1194 | ✗ | Misc->colors.triframe_tile = 18752; | |
| 1195 | ✗ | Misc->colors.triframe_cset = 1; | |
| 1196 | ✗ | Misc->colors.overworld_map_tile = 16990; | |
| 1197 | ✗ | Misc->colors.overworld_map_cset = 2; | |
| 1198 | ✗ | Misc->colors.HCpieces_tile = 21160; | |
| 1199 | ✗ | Misc->colors.HCpieces_cset = 8; | |
| 1200 | ✗ | Misc->colors.dungeon_map_tile = 19651; | |
| 1201 | ✗ | Misc->colors.dungeon_map_cset = 8; | |
| 1202 | ✗ | return true; | |
| 1203 | } | ||
| 1204 | |||
| 1205 | 314 | int32_t get_qst_buffers() | |
| 1206 | { | ||
| 1207 | 314 | TheMaps.resize(MAPSCRS); | |
| 1208 | 314 | map_autolayers.resize(6); | |
| 1209 | |||
| 1210 |
2/2✓ Branch 0 taken 42704 times.
✓ Branch 1 taken 314 times.
|
43018 | for(int32_t i(0); i<MAPSCRS; i++) |
| 1211 | 42704 | TheMaps[i].zero_memory(); | |
| 1212 | |||
| 1213 | //memset(TheMaps, 0, sizeof(mapscr)*MAPSCRS); //shouldn't need this anymore | ||
| 1214 | 314 | Z_message("OK\n"); | |
| 1215 | |||
| 1216 | // The vast majority of finished quests (and I presume this will be consistent for all time) use < 1000 strings in total. | ||
| 1217 | // (Shoelace's "Hero of Dreams" uses 1415.) | ||
| 1218 | // So let's be a bit generous and allow 4096 initially. | ||
| 1219 | // In the rare event that a quest overshoots this mark, we'll reallocate to the full 65535 later. | ||
| 1220 | // I tested it and it worked without flaw on 6/6/11. - L. | ||
| 1221 | // 2022: bumped from 4096 to 8192 to avoid a bug where the Strings menu shows (None) strings when the list passes | ||
| 1222 | // this threshold. Possibly some bug related to `msglistcache` to being reset? | ||
| 1223 | // See https://discord.com/channels/876899628556091432/992984989073416242 | ||
| 1224 | 314 | msg_strings_size = 8192; | |
| 1225 | |||
| 1226 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 314 times.
|
314 | MsgStrings = new MsgStr[msg_strings_size]; |
| 1227 | |||
| 1228 | //memset(MsgStrings, 0, sizeof(MsgStr)*msg_strings_size); | ||
| 1229 |
2/2✓ Branch 0 taken 2572288 times.
✓ Branch 1 taken 314 times.
|
2572602 | for(auto q = 0; q < msg_strings_size; ++q) |
| 1230 | { | ||
| 1231 | 2572288 | MsgStrings[q].clear(); | |
| 1232 | 2572288 | } | |
| 1233 | |||
| 1234 | |||
| 1235 |
1/2✓ Branch 0 taken 314 times.
✗ Branch 1 not taken.
|
314 | if((DoorComboSets=(DoorComboSet*)malloc(sizeof(DoorComboSet)*MAXDOORCOMBOSETS))==NULL) |
| 1236 | ✗ | return 0; | |
| 1237 | |||
| 1238 | |||
| 1239 | |||
| 1240 |
1/2✓ Branch 0 taken 314 times.
✗ Branch 1 not taken.
|
314 | if((DMaps=new dmap[MAXDMAPS])==NULL) |
| 1241 | ✗ | return 0; | |
| 1242 | |||
| 1243 | |||
| 1244 | |||
| 1245 | 314 | combobuf.clear(); | |
| 1246 | 314 | combobuf.resize(MAXCOMBOS); | |
| 1247 | |||
| 1248 | |||
| 1249 |
1/2✓ Branch 0 taken 314 times.
✗ Branch 1 not taken.
|
314 | if((colordata=(byte*)malloc(psTOTAL255))==NULL) |
| 1250 | ✗ | return 0; | |
| 1251 | |||
| 1252 | 314 | free_newtilebuf(); | |
| 1253 |
1/2✓ Branch 0 taken 314 times.
✗ Branch 1 not taken.
|
314 | if((newtilebuf=(tiledata*)malloc(NEWMAXTILES*sizeof(tiledata)))==NULL) |
| 1254 | ✗ | return 0; | |
| 1255 | |||
| 1256 | 314 | memset(newtilebuf, 0, NEWMAXTILES*sizeof(tiledata)); | |
| 1257 | //Z_message("Performed memset on tiles\n"); | ||
| 1258 | 314 | clear_tiles(newtilebuf); | |
| 1259 | //Z_message("Performed clear_tiles()\n"); | ||
| 1260 | |||
| 1261 |
2/2✓ Branch 0 taken 304 times.
✓ Branch 1 taken 10 times.
|
314 | if(is_editor()) |
| 1262 | { | ||
| 1263 |
1/2✓ Branch 0 taken 10 times.
✗ Branch 1 not taken.
|
10 | if((grabtilebuf=(tiledata*)malloc(NEWMAXTILES*sizeof(tiledata)))==NULL) |
| 1264 | ✗ | return 0; | |
| 1265 | |||
| 1266 | 10 | memset(grabtilebuf, 0, NEWMAXTILES*sizeof(tiledata)); | |
| 1267 | 10 | clear_tiles(grabtilebuf); | |
| 1268 | 10 | } | |
| 1269 | |||
| 1270 |
1/2✓ Branch 0 taken 314 times.
✗ Branch 1 not taken.
|
314 | if((trashbuf=(byte*)malloc(100000))==NULL) |
| 1271 | ✗ | return 0; | |
| 1272 | |||
| 1273 | // Big, ugly band-aid here. Perhaps the most common cause of random crashes | ||
| 1274 | // has been inadvertently accessing itemsbuf[-1]. All such crashes should be | ||
| 1275 | // fixed by ensuring there's actually itemdata there. | ||
| 1276 | // If you change this, be sure to update del_qst_buffers, too. | ||
| 1277 | |||
| 1278 |
1/2✓ Branch 0 taken 314 times.
✗ Branch 1 not taken.
|
314 | if((itemsbuf=(itemdata*)malloc(sizeof(itemdata)*(MAXITEMS+1)))==NULL) |
| 1279 | ✗ | return 0; | |
| 1280 | |||
| 1281 | 314 | memset(itemsbuf,0,sizeof(itemdata)*(MAXITEMS+1)); | |
| 1282 | 314 | itemsbuf++; | |
| 1283 | |||
| 1284 |
1/2✓ Branch 0 taken 314 times.
✗ Branch 1 not taken.
|
314 | if((wpnsbuf=(wpndata*)malloc(sizeof(wpndata)*MAXWPNS))==NULL) |
| 1285 | ✗ | return 0; | |
| 1286 | |||
| 1287 | 314 | memset(wpnsbuf,0,sizeof(wpndata)*MAXWPNS); | |
| 1288 | |||
| 1289 |
1/2✓ Branch 0 taken 314 times.
✗ Branch 1 not taken.
|
314 | if((guysbuf=(guydata*)malloc(sizeof(guydata)*MAXGUYS))==NULL) |
| 1290 | ✗ | return 0; | |
| 1291 | |||
| 1292 | 314 | memset(guysbuf,0,sizeof(guydata)*MAXGUYS); | |
| 1293 | |||
| 1294 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 314 times.
|
314 | if((combo_class_buf=(comboclass*)malloc(sizeof(comboclass)*cMAX))==NULL) |
| 1295 | ✗ | return 0; | |
| 1296 | |||
| 1297 | 314 | return 1; | |
| 1298 | 314 | } | |
| 1299 | |||
| 1300 | |||
| 1301 | 314 | void free_newtilebuf() | |
| 1302 | { | ||
| 1303 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 313 times.
|
314 | if(newtilebuf) |
| 1304 | { | ||
| 1305 |
2/2✓ Branch 0 taken 214500 times.
✓ Branch 1 taken 1 times.
|
214501 | for(int32_t i=0; i<NEWMAXTILES; i++) |
| 1306 |
1/2✓ Branch 0 taken 214500 times.
✗ Branch 1 not taken.
|
214500 | if(newtilebuf[i].data) |
| 1307 | ✗ | free(newtilebuf[i].data); | |
| 1308 | |||
| 1309 | 1 | free(newtilebuf); | |
| 1310 | 1 | newtilebuf = 0; | |
| 1311 | 1 | } | |
| 1312 | 314 | } | |
| 1313 | |||
| 1314 | ✗ | void free_grabtilebuf() | |
| 1315 | { | ||
| 1316 | ✗ | if(is_editor()) | |
| 1317 | { | ||
| 1318 | ✗ | if(grabtilebuf) | |
| 1319 | { | ||
| 1320 | ✗ | for(int32_t i=0; i<NEWMAXTILES; i++) | |
| 1321 | ✗ | if(grabtilebuf[i].data) free(grabtilebuf[i].data); | |
| 1322 | |||
| 1323 | ✗ | free(grabtilebuf); | |
| 1324 | ✗ | grabtilebuf = 0; | |
| 1325 | ✗ | } | |
| 1326 | ✗ | } | |
| 1327 | ✗ | } | |
| 1328 | |||
| 1329 | ✗ | void del_qst_buffers() | |
| 1330 | { | ||
| 1331 | ✗ | if(MsgStrings) delete[] MsgStrings; | |
| 1332 | |||
| 1333 | ✗ | if(DoorComboSets) free(DoorComboSets); | |
| 1334 | |||
| 1335 | ✗ | if (DMaps) delete[] DMaps; | |
| 1336 | |||
| 1337 | ✗ | combobuf.clear(); | |
| 1338 | |||
| 1339 | ✗ | if(colordata) free(colordata); | |
| 1340 | |||
| 1341 | ✗ | free_newtilebuf(); | |
| 1342 | ✗ | free_grabtilebuf(); | |
| 1343 | |||
| 1344 | ✗ | if(trashbuf) free(trashbuf); | |
| 1345 | |||
| 1346 | // See get_qst_buffers | ||
| 1347 | ✗ | if(itemsbuf) | |
| 1348 | { | ||
| 1349 | ✗ | itemsbuf--; | |
| 1350 | ✗ | free(itemsbuf); | |
| 1351 | ✗ | } | |
| 1352 | |||
| 1353 | ✗ | if(wpnsbuf) free(wpnsbuf); | |
| 1354 | |||
| 1355 | ✗ | if(guysbuf) free(guysbuf); | |
| 1356 | |||
| 1357 | ✗ | if(combo_class_buf) free(combo_class_buf); | |
| 1358 | ✗ | } | |
| 1359 | |||
| 1360 | 18 | bool init_palnames() | |
| 1361 | { | ||
| 1362 | // if(palnames==NULL) | ||
| 1363 | // return false; | ||
| 1364 | |||
| 1365 |
2/2✓ Branch 0 taken 9216 times.
✓ Branch 1 taken 18 times.
|
9234 | for(int32_t x=0; x<MAXLEVELS; x++) |
| 1366 | { | ||
| 1367 |
4/4✓ Branch 0 taken 9162 times.
✓ Branch 1 taken 18 times.
✓ Branch 2 taken 18 times.
✓ Branch 3 taken 18 times.
|
9216 | switch(x) |
| 1368 | { | ||
| 1369 | case 0: | ||
| 1370 | 18 | sprintf(palnames[x],"Overworld"); | |
| 1371 | 18 | break; | |
| 1372 | |||
| 1373 | case 10: | ||
| 1374 | 18 | sprintf(palnames[x],"Caves"); | |
| 1375 | 18 | break; | |
| 1376 | |||
| 1377 | case 11: | ||
| 1378 | 18 | sprintf(palnames[x],"Passageways"); | |
| 1379 | 18 | break; | |
| 1380 | |||
| 1381 | default: | ||
| 1382 | 9162 | sprintf(palnames[x],"%c",0); | |
| 1383 | 9162 | break; | |
| 1384 | } | ||
| 1385 | 9216 | } | |
| 1386 | |||
| 1387 | 18 | return true; | |
| 1388 | } | ||
| 1389 | |||
| 1390 | 97803 | static void *read_block(PACKFILE *f, int32_t size, int32_t alloc_size) | |
| 1391 | { | ||
| 1392 | void *p; | ||
| 1393 | |||
| 1394 |
1/2✓ Branch 0 taken 97803 times.
✗ Branch 1 not taken.
|
97803 | p = _AL_MALLOC(MAX(size, alloc_size)); |
| 1395 | |||
| 1396 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 97803 times.
|
97803 | if(!p) |
| 1397 | { | ||
| 1398 | ✗ | return NULL; | |
| 1399 | } | ||
| 1400 | |||
| 1401 |
1/2✓ Branch 0 taken 97803 times.
✗ Branch 1 not taken.
|
97803 | if(!pfread(p,size,f)) |
| 1402 | { | ||
| 1403 | ✗ | _AL_FREE(p); | |
| 1404 | ✗ | return NULL; | |
| 1405 | } | ||
| 1406 | |||
| 1407 |
1/2✓ Branch 0 taken 97803 times.
✗ Branch 1 not taken.
|
97803 | if(pack_ferror(f)) |
| 1408 | { | ||
| 1409 | ✗ | _AL_FREE(p); | |
| 1410 | ✗ | return NULL; | |
| 1411 | } | ||
| 1412 | |||
| 1413 | 97803 | return p; | |
| 1414 | 97803 | } | |
| 1415 | |||
| 1416 | // Only use for reading parts of older quests (Header->zelda_version <= 0x192) | ||
| 1417 | static const byte* legacy_skip_flags; | ||
| 1418 | |||
| 1419 | /* read_midi: | ||
| 1420 | * Reads MIDI data from a datafile (this is not the same thing as the | ||
| 1421 | * standard midi file format). | ||
| 1422 | */ | ||
| 1423 | |||
| 1424 | 10243 | static MIDI *read_midi(PACKFILE *f) | |
| 1425 | { | ||
| 1426 | MIDI *m; | ||
| 1427 | int32_t c; | ||
| 1428 | 10243 | int16_t divisions=0; | |
| 1429 | 10243 | int32_t len=0; | |
| 1430 | |||
| 1431 | 10243 | m = (MIDI*)_AL_MALLOC(sizeof(MIDI)); | |
| 1432 | |||
| 1433 |
1/2✓ Branch 0 taken 10243 times.
✗ Branch 1 not taken.
|
10243 | if(!m) |
| 1434 | { | ||
| 1435 | ✗ | return NULL; | |
| 1436 | } | ||
| 1437 | |||
| 1438 |
2/2✓ Branch 0 taken 327776 times.
✓ Branch 1 taken 10243 times.
|
338019 | for(c=0; c<MIDI_TRACKS; c++) |
| 1439 | { | ||
| 1440 | 327776 | m->track[c].len = 0; | |
| 1441 | 327776 | m->track[c].data = NULL; | |
| 1442 | 327776 | } | |
| 1443 | |||
| 1444 | 10243 | p_mgetw(&divisions,f); | |
| 1445 | 10243 | m->divisions=divisions; | |
| 1446 | |||
| 1447 |
2/2✓ Branch 0 taken 327776 times.
✓ Branch 1 taken 10243 times.
|
338019 | for(c=0; c<MIDI_TRACKS; c++) |
| 1448 | { | ||
| 1449 | 327776 | p_mgetl(&len,f); | |
| 1450 | 327776 | m->track[c].len=len; | |
| 1451 | |||
| 1452 |
2/2✓ Branch 0 taken 229973 times.
✓ Branch 1 taken 97803 times.
|
327776 | if(m->track[c].len > 0) |
| 1453 | { | ||
| 1454 | 97803 | m->track[c].data = (byte*)read_block(f, m->track[c].len, 0); | |
| 1455 | |||
| 1456 |
1/2✓ Branch 0 taken 97803 times.
✗ Branch 1 not taken.
|
97803 | if(!m->track[c].data) |
| 1457 | { | ||
| 1458 | ✗ | destroy_midi(m); | |
| 1459 | ✗ | return NULL; | |
| 1460 | } | ||
| 1461 | 97803 | } | |
| 1462 | 327776 | } | |
| 1463 | |||
| 1464 | LOCK_DATA(m, sizeof(MIDI)); | ||
| 1465 | |||
| 1466 |
2/2✓ Branch 0 taken 327776 times.
✓ Branch 1 taken 10243 times.
|
338019 | for(c=0; c<MIDI_TRACKS; c++) |
| 1467 | { | ||
| 1468 |
2/2✓ Branch 0 taken 97803 times.
✓ Branch 1 taken 229973 times.
|
327776 | if(m->track[c].data) |
| 1469 | { | ||
| 1470 | LOCK_DATA(m->track[c].data, m->track[c].len); | ||
| 1471 | 97803 | } | |
| 1472 | 327776 | } | |
| 1473 | |||
| 1474 | 10243 | return m; | |
| 1475 | 10243 | } | |
| 1476 | |||
| 1477 | ✗ | void clear_combo(int32_t i) | |
| 1478 | { | ||
| 1479 | ✗ | combobuf[i].clear(); | |
| 1480 | ✗ | } | |
| 1481 | |||
| 1482 | ✗ | void clear_combos() | |
| 1483 | { | ||
| 1484 | ✗ | for(int32_t tmpcounter=0; tmpcounter<MAXCOMBOS; tmpcounter++) | |
| 1485 | ✗ | clear_combo(tmpcounter); | |
| 1486 | ✗ | } | |
| 1487 | |||
| 1488 | ✗ | void pack_combos() | |
| 1489 | { | ||
| 1490 | ✗ | int32_t di = 0; | |
| 1491 | |||
| 1492 | ✗ | for(int32_t si=0; si<1024; si+=2) | |
| 1493 | ✗ | combobuf[di++] = combobuf[si]; | |
| 1494 | |||
| 1495 | ✗ | for(; di<1024; di++) | |
| 1496 | ✗ | clear_combo(di); | |
| 1497 | ✗ | } | |
| 1498 | |||
| 1499 | 694 | void reset_tunes(zctune *tune) | |
| 1500 | { | ||
| 1501 |
2/2✓ Branch 0 taken 174888 times.
✓ Branch 1 taken 694 times.
|
175582 | for(int32_t i=0; i<MAXCUSTOMTUNES; i++) |
| 1502 | { | ||
| 1503 | 174888 | tune[i].reset(); | |
| 1504 | 174888 | } | |
| 1505 | 694 | } | |
| 1506 | |||
| 1507 | |||
| 1508 | /*void reset_midi(zcmidi_ *m) | ||
| 1509 | { | ||
| 1510 | m->title[0]=0; | ||
| 1511 | m->loop=1; | ||
| 1512 | m->volume=144; | ||
| 1513 | m->start=0; | ||
| 1514 | m->loop_start=-1; | ||
| 1515 | m->loop_end=-1; | ||
| 1516 | if(m->midi) | ||
| 1517 | { | ||
| 1518 | destroy_midi(m->midi); | ||
| 1519 | } | ||
| 1520 | m->midi=NULL; | ||
| 1521 | } | ||
| 1522 | |||
| 1523 | |||
| 1524 | void reset_midis(zcmidi_ *m) | ||
| 1525 | { | ||
| 1526 | for(int32_t i=0; i<MAXCUSTOMMIDIS; i++) | ||
| 1527 | { | ||
| 1528 | reset_midi(m+i); | ||
| 1529 | } | ||
| 1530 | } | ||
| 1531 | */ | ||
| 1532 | |||
| 1533 | ✗ | void reset_scr(int32_t scr) | |
| 1534 | { | ||
| 1535 | /* | ||
| 1536 | byte *di=((byte*)TheMaps)+(scr*sizeof(mapscr)); | ||
| 1537 | for(unsigned i=0; i<sizeof(mapscr); i++) | ||
| 1538 | *(di++) = 0; | ||
| 1539 | TheMaps[scr].valid=mVERSION; | ||
| 1540 | */ | ||
| 1541 | |||
| 1542 | ✗ | TheMaps[scr].zero_memory(); | |
| 1543 | //byte *di=((byte*)TheMaps)+(scr*sizeof(mapscr)); | ||
| 1544 | |||
| 1545 | ✗ | for(int32_t i=0; i<6; i++) | |
| 1546 | { | ||
| 1547 | //these will be uncommented later | ||
| 1548 | //TheMaps[scr].layerxsize[i]=16; | ||
| 1549 | //TheMaps[scr].layerysize[i]=11; | ||
| 1550 | ✗ | TheMaps[scr].layeropacity[i]=255; | |
| 1551 | ✗ | } | |
| 1552 | |||
| 1553 | ✗ | TheMaps[scr].valid=mVERSION; | |
| 1554 | |||
| 1555 | ✗ | } | |
| 1556 | |||
| 1557 | /* For reference: | ||
| 1558 | |||
| 1559 | enum { qe_OK, qe_notfound, qe_invalid, qe_version, qe_obsolete, | ||
| 1560 | qe_missing, qe_internal, qe_pwd, qe_match, qe_minver }; | ||
| 1561 | */ | ||
| 1562 | |||
| 1563 | 28922 | int32_t operator ==(DoorComboSet a, DoorComboSet b) | |
| 1564 | { | ||
| 1565 |
2/2✓ Branch 0 taken 63938 times.
✓ Branch 1 taken 4377 times.
|
68315 | for(int32_t i=0; i<9; i++) |
| 1566 | { | ||
| 1567 |
2/2✓ Branch 0 taken 262433 times.
✓ Branch 1 taken 39699 times.
|
302132 | for(int32_t j=0; j<6; j++) |
| 1568 | { | ||
| 1569 |
2/2✓ Branch 0 taken 79398 times.
✓ Branch 1 taken 183035 times.
|
262433 | if(j<4) |
| 1570 | { | ||
| 1571 |
2/2✓ Branch 0 taken 158796 times.
✓ Branch 1 taken 24239 times.
|
183035 | if(a.doorcombo_u[i][j]!=b.doorcombo_u[i][j]) |
| 1572 | { | ||
| 1573 | 24239 | return false; | |
| 1574 | } | ||
| 1575 | |||
| 1576 |
1/2✓ Branch 0 taken 158796 times.
✗ Branch 1 not taken.
|
158796 | if(a.doorcset_u[i][j]!=b.doorcset_u[i][j]) |
| 1577 | { | ||
| 1578 | ✗ | return false; | |
| 1579 | } | ||
| 1580 | |||
| 1581 |
1/2✓ Branch 0 taken 158796 times.
✗ Branch 1 not taken.
|
158796 | if(a.doorcombo_d[i][j]!=b.doorcombo_d[i][j]) |
| 1582 | { | ||
| 1583 | ✗ | return false; | |
| 1584 | } | ||
| 1585 | |||
| 1586 |
1/2✓ Branch 0 taken 158796 times.
✗ Branch 1 not taken.
|
158796 | if(a.doorcset_d[i][j]!=b.doorcset_d[i][j]) |
| 1587 | { | ||
| 1588 | ✗ | return false; | |
| 1589 | } | ||
| 1590 | 158796 | } | |
| 1591 | |||
| 1592 |
1/2✓ Branch 0 taken 238194 times.
✗ Branch 1 not taken.
|
238194 | if(a.doorcombo_l[i][j]!=b.doorcombo_l[i][j]) |
| 1593 | { | ||
| 1594 | ✗ | return false; | |
| 1595 | } | ||
| 1596 | |||
| 1597 |
1/2✓ Branch 0 taken 238194 times.
✗ Branch 1 not taken.
|
238194 | if(a.doorcset_l[i][j]!=b.doorcset_l[i][j]) |
| 1598 | { | ||
| 1599 | ✗ | return false; | |
| 1600 | } | ||
| 1601 | |||
| 1602 |
1/2✓ Branch 0 taken 238194 times.
✗ Branch 1 not taken.
|
238194 | if(a.doorcombo_r[i][j]!=b.doorcombo_r[i][j]) |
| 1603 | { | ||
| 1604 | ✗ | return false; | |
| 1605 | } | ||
| 1606 | |||
| 1607 |
1/2✓ Branch 0 taken 238194 times.
✗ Branch 1 not taken.
|
238194 | if(a.doorcset_r[i][j]!=b.doorcset_r[i][j]) |
| 1608 | { | ||
| 1609 | ✗ | return false; | |
| 1610 | } | ||
| 1611 | 238194 | } | |
| 1612 | |||
| 1613 |
2/2✓ Branch 0 taken 30639 times.
✓ Branch 1 taken 9060 times.
|
39699 | if(i<2) |
| 1614 | { | ||
| 1615 |
1/2✓ Branch 0 taken 9060 times.
✗ Branch 1 not taken.
|
9060 | if(a.flags[i]!=b.flags[i]) |
| 1616 | { | ||
| 1617 | ✗ | return false; | |
| 1618 | } | ||
| 1619 | |||
| 1620 |
2/2✓ Branch 0 taken 9036 times.
✓ Branch 1 taken 24 times.
|
9060 | if(a.bombdoorcombo_u[i]!=b.bombdoorcombo_u[i]) |
| 1621 | { | ||
| 1622 | 24 | return false; | |
| 1623 | } | ||
| 1624 | |||
| 1625 |
1/2✓ Branch 0 taken 9036 times.
✗ Branch 1 not taken.
|
9036 | if(a.bombdoorcset_u[i]!=b.bombdoorcset_u[i]) |
| 1626 | { | ||
| 1627 | ✗ | return false; | |
| 1628 | } | ||
| 1629 | |||
| 1630 |
1/2✓ Branch 0 taken 9036 times.
✗ Branch 1 not taken.
|
9036 | if(a.bombdoorcombo_d[i]!=b.bombdoorcombo_d[i]) |
| 1631 | { | ||
| 1632 | ✗ | return false; | |
| 1633 | } | ||
| 1634 | |||
| 1635 |
1/2✓ Branch 0 taken 9036 times.
✗ Branch 1 not taken.
|
9036 | if(a.bombdoorcset_d[i]!=b.bombdoorcset_d[i]) |
| 1636 | { | ||
| 1637 | ✗ | return false; | |
| 1638 | } | ||
| 1639 | 9036 | } | |
| 1640 | |||
| 1641 |
2/2✓ Branch 0 taken 26262 times.
✓ Branch 1 taken 13413 times.
|
39675 | if(i<3) |
| 1642 | { | ||
| 1643 |
1/2✓ Branch 0 taken 13413 times.
✗ Branch 1 not taken.
|
13413 | if(a.bombdoorcombo_l[i]!=b.bombdoorcombo_l[i]) |
| 1644 | { | ||
| 1645 | ✗ | return false; | |
| 1646 | } | ||
| 1647 | |||
| 1648 |
1/2✓ Branch 0 taken 13413 times.
✗ Branch 1 not taken.
|
13413 | if(a.bombdoorcset_l[i]!=b.bombdoorcset_l[i]) |
| 1649 | { | ||
| 1650 | ✗ | return false; | |
| 1651 | } | ||
| 1652 | |||
| 1653 |
1/2✓ Branch 0 taken 13413 times.
✗ Branch 1 not taken.
|
13413 | if(a.bombdoorcombo_r[i]!=b.bombdoorcombo_r[i]) |
| 1654 | { | ||
| 1655 | ✗ | return false; | |
| 1656 | } | ||
| 1657 | |||
| 1658 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 13413 times.
|
13413 | if(a.bombdoorcset_r[i]!=b.bombdoorcset_r[i]) |
| 1659 | { | ||
| 1660 | ✗ | return false; | |
| 1661 | } | ||
| 1662 | 13413 | } | |
| 1663 | |||
| 1664 |
2/2✓ Branch 0 taken 39393 times.
✓ Branch 1 taken 282 times.
|
39675 | if(a.walkthroughcombo[i]!=b.walkthroughcombo[i]) |
| 1665 | { | ||
| 1666 | 282 | return false; | |
| 1667 | } | ||
| 1668 | |||
| 1669 |
1/2✓ Branch 0 taken 39393 times.
✗ Branch 1 not taken.
|
39393 | if(a.walkthroughcset[i]!=b.walkthroughcset[i]) |
| 1670 | { | ||
| 1671 | ✗ | return false; | |
| 1672 | } | ||
| 1673 | 39393 | } | |
| 1674 | |||
| 1675 | 4377 | return true; | |
| 1676 | 28922 | } | |
| 1677 | |||
| 1678 | int32_t doortranslations_u[9][4]= | ||
| 1679 | { | ||
| 1680 | {37,38,53,54}, | ||
| 1681 | {37,38,39,40}, | ||
| 1682 | {37,38,55,56}, | ||
| 1683 | {37,38,39,40}, | ||
| 1684 | {37,38,53,54}, | ||
| 1685 | {37,38,53,54}, | ||
| 1686 | {37,38,53,54}, | ||
| 1687 | {7,8,23,24}, | ||
| 1688 | {7,8,41,42} | ||
| 1689 | }; | ||
| 1690 | |||
| 1691 | int32_t doortranslations_d[9][4]= | ||
| 1692 | { | ||
| 1693 | {117,118,133,134}, | ||
| 1694 | {135,136,133,134}, | ||
| 1695 | {119,120,133,134}, | ||
| 1696 | {135,136,133,134}, | ||
| 1697 | {117,118,133,134}, | ||
| 1698 | {117,118,133,134}, | ||
| 1699 | {117,118,133,134}, | ||
| 1700 | {151,152,167,168}, | ||
| 1701 | {137,138,167,168}, | ||
| 1702 | }; | ||
| 1703 | |||
| 1704 | //enum {dt_pass=0, dt_lock, dt_shut, dt_boss, dt_olck, dt_osht, dt_obos, dt_wall, dt_bomb, dt_walk, dt_max}; | ||
| 1705 | int32_t doortranslations_l[9][6]= | ||
| 1706 | { | ||
| 1707 | {66,67,82,83,98,99}, | ||
| 1708 | {66,68,82,84,98,100}, | ||
| 1709 | {66,69,82,85,98,101}, | ||
| 1710 | {66,68,82,84,98,100}, | ||
| 1711 | {66,67,82,83,98,99}, | ||
| 1712 | {66,67,82,83,98,99}, | ||
| 1713 | {66,67,82,83,98,99}, | ||
| 1714 | {64,65,80,81,96,97}, | ||
| 1715 | {64,65,80,114,96,97}, | ||
| 1716 | }; | ||
| 1717 | |||
| 1718 | int32_t doortranslations_r[9][6]= | ||
| 1719 | { | ||
| 1720 | |||
| 1721 | {76,77,92,93,108,109}, | ||
| 1722 | {75,77,91,93,107,109}, | ||
| 1723 | {74,77,90,93,106,109}, | ||
| 1724 | {75,77,91,93,107,109}, | ||
| 1725 | {76,77,92,93,108,109}, | ||
| 1726 | {76,77,92,93,108,109}, | ||
| 1727 | {76,77,92,93,108,109}, | ||
| 1728 | {78,79,94,95,110,111}, | ||
| 1729 | {78,79,125,95,110,111}, | ||
| 1730 | }; | ||
| 1731 | |||
| 1732 | 858450 | int32_t tdcmbdat(int32_t map, int32_t scr, int32_t pos) | |
| 1733 | { | ||
| 1734 | 858450 | return (TheMaps[map*MAPSCRS+TEMPLATE].data[pos]&0xFF)+((TheMaps[map*MAPSCRS+scr].old_cpage)<<8); | |
| 1735 | } | ||
| 1736 | |||
| 1737 | 840750 | int32_t tdcmbcset(int32_t map, int32_t scr, int32_t pos) | |
| 1738 | { | ||
| 1739 | //these are here to bypass compiler warnings about unused arguments | ||
| 1740 | 840750 | map=map; | |
| 1741 | 840750 | scr=scr; | |
| 1742 | 840750 | pos=pos; | |
| 1743 | |||
| 1744 | //what does this function do? | ||
| 1745 | // return TheMaps[map*MAPSCRS+TEMPLATE].cset[pos]; | ||
| 1746 | 840750 | return 2; | |
| 1747 | } | ||
| 1748 | |||
| 1749 | 22848 | int32_t MakeDoors(int32_t map, int32_t scr) | |
| 1750 | { | ||
| 1751 |
2/2✓ Branch 0 taken 18423 times.
✓ Branch 1 taken 4425 times.
|
22848 | if(!(TheMaps[map*MAPSCRS+scr].valid&mVALID)) |
| 1752 | { | ||
| 1753 | 18423 | return 0; | |
| 1754 | } | ||
| 1755 | |||
| 1756 | DoorComboSet tempdcs; | ||
| 1757 | 4425 | memset(&tempdcs, 0, sizeof(DoorComboSet)); | |
| 1758 | |||
| 1759 | //up | ||
| 1760 |
2/2✓ Branch 0 taken 39825 times.
✓ Branch 1 taken 4425 times.
|
44250 | for(int32_t i=0; i<9; i++) |
| 1761 | { | ||
| 1762 |
2/2✓ Branch 0 taken 159300 times.
✓ Branch 1 taken 39825 times.
|
199125 | for(int32_t j=0; j<4; j++) |
| 1763 | { | ||
| 1764 | 159300 | tempdcs.doorcombo_u[i][j]=tdcmbdat(map,scr,doortranslations_u[i][j]); | |
| 1765 | 159300 | tempdcs.doorcset_u[i][j]=tdcmbcset(map,scr,doortranslations_u[i][j]); | |
| 1766 | 159300 | } | |
| 1767 | 39825 | } | |
| 1768 | |||
| 1769 | 4425 | tempdcs.bombdoorcombo_u[0]=tdcmbdat(map,scr,57); | |
| 1770 | 4425 | tempdcs.bombdoorcset_u[0]=tdcmbcset(map,scr,57); | |
| 1771 | 4425 | tempdcs.bombdoorcombo_u[1]=tdcmbdat(map,scr,58); | |
| 1772 | 4425 | tempdcs.bombdoorcset_u[1]=tdcmbcset(map,scr,58); | |
| 1773 | 4425 | tempdcs.walkthroughcombo[0]=tdcmbdat(map,scr,34); | |
| 1774 | 4425 | tempdcs.walkthroughcset[0]=tdcmbdat(map,scr,34); | |
| 1775 | |||
| 1776 | //down | ||
| 1777 |
2/2✓ Branch 0 taken 39825 times.
✓ Branch 1 taken 4425 times.
|
44250 | for(int32_t i=0; i<9; i++) |
| 1778 | { | ||
| 1779 |
2/2✓ Branch 0 taken 159300 times.
✓ Branch 1 taken 39825 times.
|
199125 | for(int32_t j=0; j<4; j++) |
| 1780 | { | ||
| 1781 | 159300 | tempdcs.doorcombo_d[i][j]=tdcmbdat(map,scr,doortranslations_d[i][j]); | |
| 1782 | 159300 | tempdcs.doorcset_d[i][j]=tdcmbcset(map,scr,doortranslations_d[i][j]); | |
| 1783 | 159300 | } | |
| 1784 | 39825 | } | |
| 1785 | |||
| 1786 | 4425 | tempdcs.bombdoorcombo_d[0]=tdcmbdat(map,scr,121); | |
| 1787 | |||
| 1788 | 4425 | tempdcs.bombdoorcset_d[0]=tdcmbcset(map,scr,121); | |
| 1789 | 4425 | tempdcs.bombdoorcombo_d[1]=tdcmbdat(map,scr,122); | |
| 1790 | 4425 | tempdcs.bombdoorcset_d[1]=tdcmbcset(map,scr,122); | |
| 1791 | 4425 | tempdcs.walkthroughcombo[1]=tdcmbdat(map,scr,34); | |
| 1792 | 4425 | tempdcs.walkthroughcset[1]=tdcmbdat(map,scr,34); | |
| 1793 | |||
| 1794 | //left | ||
| 1795 | // TheMaps[i*MAPSCRS+j].warpdmap=TheOldMap.warpdmap; | ||
| 1796 |
2/2✓ Branch 0 taken 39825 times.
✓ Branch 1 taken 4425 times.
|
44250 | for(int32_t i=0; i<9; i++) |
| 1797 | { | ||
| 1798 |
2/2✓ Branch 0 taken 238950 times.
✓ Branch 1 taken 39825 times.
|
278775 | for(int32_t j=0; j<6; j++) |
| 1799 | { | ||
| 1800 | 238950 | tempdcs.doorcombo_l[i][j]=tdcmbdat(map,scr,doortranslations_l[i][j]); | |
| 1801 | 238950 | tempdcs.doorcset_l[i][j]=tdcmbcset(map,scr,doortranslations_l[i][j]); | |
| 1802 | 238950 | } | |
| 1803 | 39825 | } | |
| 1804 | |||
| 1805 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4425 times.
|
4425 | for(int32_t j=0; j>6; j++) |
| 1806 | { | ||
| 1807 | ✗ | if((j!=2)&&(j!=3)) | |
| 1808 | { | ||
| 1809 | ✗ | tempdcs.doorcombo_l[dt_bomb][j]=TheMaps[map*MAPSCRS+scr].data[doortranslations_l[dt_bomb][j]]; | |
| 1810 | ✗ | tempdcs.doorcset_l[dt_bomb][j]=TheMaps[map*MAPSCRS+scr].cset[doortranslations_l[dt_bomb][j]]; | |
| 1811 | ✗ | } | |
| 1812 | ✗ | } | |
| 1813 | |||
| 1814 | 4425 | tempdcs.bombdoorcombo_l[0]=0; | |
| 1815 | 4425 | tempdcs.bombdoorcset_l[0]=tdcmbcset(map,scr,115); | |
| 1816 | 4425 | tempdcs.bombdoorcombo_l[1]=tdcmbdat(map,scr,115); | |
| 1817 | 4425 | tempdcs.bombdoorcset_l[1]=tdcmbcset(map,scr,115); | |
| 1818 | 4425 | tempdcs.bombdoorcombo_l[2]=0; | |
| 1819 | 4425 | tempdcs.bombdoorcset_l[2]=tdcmbcset(map,scr,115); | |
| 1820 | 4425 | tempdcs.walkthroughcombo[2]=tdcmbdat(map,scr,34); | |
| 1821 | 4425 | tempdcs.walkthroughcset[2]=tdcmbdat(map,scr,34); | |
| 1822 | |||
| 1823 | //right | ||
| 1824 |
2/2✓ Branch 0 taken 39825 times.
✓ Branch 1 taken 4425 times.
|
44250 | for(int32_t i=0; i<9; i++) |
| 1825 | { | ||
| 1826 |
2/2✓ Branch 0 taken 238950 times.
✓ Branch 1 taken 39825 times.
|
278775 | for(int32_t j=0; j<6; j++) |
| 1827 | { | ||
| 1828 | 238950 | tempdcs.doorcombo_r[i][j]=tdcmbdat(map,scr,doortranslations_r[i][j]); | |
| 1829 | 238950 | tempdcs.doorcset_r[i][j]=tdcmbcset(map,scr,doortranslations_r[i][j]); | |
| 1830 | 238950 | } | |
| 1831 | 39825 | } | |
| 1832 | |||
| 1833 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4425 times.
|
4425 | for(int32_t j=0; j>6; j++) |
| 1834 | { | ||
| 1835 | ✗ | if((j!=2)&&(j!=3)) | |
| 1836 | { | ||
| 1837 | ✗ | tempdcs.doorcombo_r[dt_bomb][j]=TheMaps[map*MAPSCRS+scr].data[doortranslations_r[dt_bomb][j]]; | |
| 1838 | ✗ | tempdcs.doorcset_r[dt_bomb][j]=TheMaps[map*MAPSCRS+scr].cset[doortranslations_r[dt_bomb][j]]; | |
| 1839 | ✗ | } | |
| 1840 | ✗ | } | |
| 1841 | |||
| 1842 | 4425 | tempdcs.bombdoorcombo_r[0]=0; | |
| 1843 | 4425 | tempdcs.bombdoorcset_r[0]=tdcmbcset(map,scr,124); | |
| 1844 | 4425 | tempdcs.bombdoorcombo_r[1]=tdcmbdat(map,scr,124); | |
| 1845 | 4425 | tempdcs.bombdoorcset_r[1]=tdcmbcset(map,scr,124); | |
| 1846 | 4425 | tempdcs.bombdoorcombo_r[2]=0; | |
| 1847 | 4425 | tempdcs.bombdoorcset_r[2]=tdcmbcset(map,scr,124); | |
| 1848 | 4425 | tempdcs.walkthroughcombo[3]=tdcmbdat(map,scr,34); | |
| 1849 | 4425 | tempdcs.walkthroughcset[3]=tdcmbdat(map,scr,34); | |
| 1850 | |||
| 1851 | int32_t k; | ||
| 1852 | |||
| 1853 |
2/2✓ Branch 0 taken 48 times.
✓ Branch 1 taken 28922 times.
|
28970 | for(k=0; k<door_combo_set_count; k++) |
| 1854 | { | ||
| 1855 |
2/2✓ Branch 0 taken 4377 times.
✓ Branch 1 taken 24545 times.
|
28922 | if(DoorComboSets[k]==tempdcs) |
| 1856 | { | ||
| 1857 | 4377 | break; | |
| 1858 | } | ||
| 1859 | 24545 | } | |
| 1860 | |||
| 1861 |
2/2✓ Branch 0 taken 4377 times.
✓ Branch 1 taken 48 times.
|
4425 | if(k==door_combo_set_count) |
| 1862 | { | ||
| 1863 | 48 | DoorComboSets[k]=tempdcs; | |
| 1864 | 48 | sprintf(DoorComboSets[k].name, "Door Combo Set %d", k); | |
| 1865 | 48 | ++door_combo_set_count; | |
| 1866 | 48 | } | |
| 1867 | |||
| 1868 | 4425 | return k; | |
| 1869 | /* | ||
| 1870 | doorcombo_u[9][4]; | ||
| 1871 | doorcset_u[9][4]; | ||
| 1872 | doorcombo_d[9][4]; | ||
| 1873 | doorcset_d[9][4]; | ||
| 1874 | doorcombo_l[9][6]; | ||
| 1875 | doorcset_l[9][6]; | ||
| 1876 | doorcombo_r[9][6]; | ||
| 1877 | doorcset_r[9][6]; | ||
| 1878 | bombdoorcombo_u[2]; | ||
| 1879 | bombdoorcset_u[2]; | ||
| 1880 | bombdoorcombo_d[2]; | ||
| 1881 | bombdoorcset_d[2]; | ||
| 1882 | bombdoorcombo_l[3]; | ||
| 1883 | bombdoorcset_l[3]; | ||
| 1884 | bombdoorcombo_r[3]; | ||
| 1885 | bombdoorcset_r[3]; | ||
| 1886 | walkthroughcombo[4]; | ||
| 1887 | walkthroughcset[4]; | ||
| 1888 | */ | ||
| 1889 | 22848 | } | |
| 1890 | |||
| 1891 | 2924544 | INLINE int32_t tcmbdat2(int32_t map, int32_t scr, int32_t pos) | |
| 1892 | { | ||
| 1893 | 2924544 | return (TheMaps[map*MAPSCRS+TEMPLATE2].data[pos]&0xFF)+((TheMaps[map*MAPSCRS+scr].old_cpage)<<8); | |
| 1894 | } | ||
| 1895 | |||
| 1896 | 2924544 | INLINE int32_t tcmbcset2(int32_t map, int32_t pos) | |
| 1897 | { | ||
| 1898 | |||
| 1899 | 2924544 | return TheMaps[map*MAPSCRS+TEMPLATE2].cset[pos]; | |
| 1900 | } | ||
| 1901 | |||
| 1902 | 2924544 | INLINE int32_t tcmbflag2(int32_t map, int32_t pos) | |
| 1903 | { | ||
| 1904 | 2924544 | return TheMaps[map*MAPSCRS+TEMPLATE2].sflag[pos]; | |
| 1905 | } | ||
| 1906 | |||
| 1907 | |||
| 1908 | 83 | void get_questpwd(char *encrypted_pwd, int16_t pwdkey, char *pwd) | |
| 1909 | { | ||
| 1910 | char temp_pwd[30]; | ||
| 1911 | 83 | memset(temp_pwd,0,30); | |
| 1912 | |||
| 1913 |
2/2✓ Branch 0 taken 75 times.
✓ Branch 1 taken 8 times.
|
83 | if(pwdkey!=0) |
| 1914 | { | ||
| 1915 | 75 | memcpy(temp_pwd,encrypted_pwd,30); | |
| 1916 | 75 | temp_pwd[29]=0; | |
| 1917 | |||
| 1918 |
2/2✓ Branch 0 taken 2250 times.
✓ Branch 1 taken 75 times.
|
2325 | for(int32_t i=0; i<30; i++) |
| 1919 | { | ||
| 1920 | 2250 | temp_pwd[i] -= pwdkey; | |
| 1921 | 2250 | int32_t t=pwdkey>>15; | |
| 1922 | 2250 | pwdkey = (pwdkey<<1)+t; | |
| 1923 | 2250 | } | |
| 1924 | 75 | } | |
| 1925 | |||
| 1926 | 83 | memcpy(pwd,temp_pwd,30); | |
| 1927 | 83 | } | |
| 1928 | |||
| 1929 | |||
| 1930 | 276 | bool devpwd() | |
| 1931 | { | ||
| 1932 | #ifdef _DEBUG | ||
| 1933 | return true; | ||
| 1934 | #endif | ||
| 1935 | #if DEVLEVEL > 3 | ||
| 1936 | return true; | ||
| 1937 | #endif | ||
| 1938 |
1/2✓ Branch 0 taken 276 times.
✗ Branch 1 not taken.
|
276 | return !strcmp(zc_get_config("dev","pwd","",App::zquest), (char*)clavio) || is_ci(); |
| 1939 | } | ||
| 1940 | ✗ | bool check_questpwd(zquestheader *Header, char *pwd) | |
| 1941 | { | ||
| 1942 | ✗ | if(devpwd()) | |
| 1943 | ✗ | return true; | |
| 1944 | ✗ | if((!strcmp(pwd, (char*)clavio))) | |
| 1945 | ✗ | return true; | |
| 1946 | cvs_MD5Context ctx; | ||
| 1947 | uint8_t md5sum[16]; | ||
| 1948 | |||
| 1949 | ✗ | cvs_MD5Init(&ctx); | |
| 1950 | ✗ | cvs_MD5Update(&ctx, (const uint8_t*)pwd, (unsigned)strlen(pwd)); | |
| 1951 | ✗ | cvs_MD5Final(md5sum, &ctx); | |
| 1952 | |||
| 1953 | ✗ | return (memcmp(Header->pwd_hash,md5sum,16)==0); | |
| 1954 | ✗ | } | |
| 1955 | |||
| 1956 | static char const* key_exts[KEYFILE_NUMTY] = {"key", "zcheat", "zpwd"}; | ||
| 1957 | static bool key_hashed[KEYFILE_NUMTY] = {false, true, false}; | ||
| 1958 | static char const* key_namestr[KEYFILE_NUMTY] = {"Master","Cheat","ZPwd"}; | ||
| 1959 | |||
| 1960 | ✗ | static bool check_keyfile(char const* path, char const* ext, bool hashed, char const* typestr, zquestheader* Header) | |
| 1961 | { | ||
| 1962 | char keyfilename[2048]; | ||
| 1963 | ✗ | replace_extension(keyfilename, path, ext, 2047); | |
| 1964 | ✗ | if(!exists(keyfilename)) | |
| 1965 | ✗ | return false; | |
| 1966 | ✗ | bool ret = false; | |
| 1967 | |||
| 1968 | ✗ | char password[QSTPWD_LEN] = {0}, pwd[32] = {0}; | |
| 1969 | ✗ | PACKFILE *fp = pack_fopen_password(keyfilename, F_READ,""); | |
| 1970 | ✗ | char msg[80] = {0}; | |
| 1971 | ✗ | pfread(msg, 80, fp); | |
| 1972 | ✗ | if(strcmp(msg,"ZQuest Auto-Generated Quest Password Key File. DO NOT EDIT!")) | |
| 1973 | { | ||
| 1974 | ✗ | zprint2("Found %s Key File '%s' (invalid header)\n", typestr, keyfilename); | |
| 1975 | ✗ | pack_fclose(fp); | |
| 1976 | ✗ | return false; | |
| 1977 | } | ||
| 1978 | int16_t ver; | ||
| 1979 | byte bld; | ||
| 1980 | ✗ | p_igetw(&ver, fp); | |
| 1981 | ✗ | p_getc(&bld, fp); | |
| 1982 | ✗ | pfread(password, QSTPWD_LEN, fp, true); | |
| 1983 | ✗ | if(hashed) | |
| 1984 | { | ||
| 1985 | ✗ | char unhashed_pw[QSTPWD_LEN] = {0}; | |
| 1986 | |||
| 1987 | ✗ | char hashmap = 'Z'; | |
| 1988 | ✗ | hashmap += 'Q'; | |
| 1989 | ✗ | hashmap += 'U'; | |
| 1990 | ✗ | hashmap += 'E'; | |
| 1991 | ✗ | hashmap += 'S'; | |
| 1992 | ✗ | hashmap += 'T'; | |
| 1993 | |||
| 1994 | ✗ | for ( int32_t q = 0; q < QSTPWD_LEN; ++q ) | |
| 1995 | ✗ | unhashed_pw[q] = password[q] - hashmap; | |
| 1996 | |||
| 1997 | ✗ | ret = check_questpwd(Header, unhashed_pw); | |
| 1998 | ✗ | } | |
| 1999 | ✗ | else ret = check_questpwd(Header, password); | |
| 2000 | ✗ | pack_fclose(fp); | |
| 2001 | ✗ | zprint2("Found %s Key File '%s' (%s access)\n", | |
| 2002 | ✗ | typestr, keyfilename, ret ? "valid" : "invalid"); | |
| 2003 | ✗ | return ret; | |
| 2004 | ✗ | } | |
| 2005 | |||
| 2006 | ✗ | bool check_keyfiles(char const* path, vector<uint> types, zquestheader* Header) | |
| 2007 | { | ||
| 2008 | ✗ | char exedir[PATH_MAX] = {0}; | |
| 2009 | ✗ | extract_name(path, exedir, FILENAMEALL); | |
| 2010 | ✗ | char const* paths[] = {path, exedir}; | |
| 2011 | ✗ | for(uint keyty : types) | |
| 2012 | { | ||
| 2013 | ✗ | if(keyty >= KEYFILE_NUMTY) | |
| 2014 | ✗ | continue; | |
| 2015 | ✗ | for(char const* p : paths) | |
| 2016 | { | ||
| 2017 | ✗ | if(check_keyfile(p, key_exts[keyty], key_hashed[keyty], key_namestr[keyty], Header)) | |
| 2018 | ✗ | return true; | |
| 2019 | } | ||
| 2020 | } | ||
| 2021 | ✗ | return false; | |
| 2022 | ✗ | } | |
| 2023 | |||
| 2024 | 381 | void print_quest_metadata(zquestheader const& tempheader, char const* path, byte qst_num) | |
| 2025 | { | ||
| 2026 | 381 | zprint2("\n"); | |
| 2027 | 381 | zprint2("[QUEST METADATA]\n"); | |
| 2028 |
2/2✓ Branch 0 taken 372 times.
✓ Branch 1 taken 9 times.
|
381 | if(qst_num < moduledata.max_quest_files) |
| 2029 | 9 | zprint2("Loading module quest %d\n", qst_num+1); | |
| 2030 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 381 times.
|
381 | if(path) zprint2("Loading '%s'\n", path); |
| 2031 | 381 | zprint2("Last saved in version %s\n", tempheader.getVerStr()); | |
| 2032 | |||
| 2033 |
2/2✓ Branch 0 taken 243 times.
✓ Branch 1 taken 138 times.
|
381 | if ( tempheader.made_in_module_name[0] ) zprint2("Created with ZC Module: %s\n\n", tempheader.made_in_module_name); |
| 2034 |
2/2✓ Branch 0 taken 243 times.
✓ Branch 1 taken 138 times.
|
381 | if ( tempheader.new_version_devsig[0] ) zprint2("Developr Signoff by: %s\n", tempheader.new_version_devsig); |
| 2035 |
2/2✓ Branch 0 taken 243 times.
✓ Branch 1 taken 138 times.
|
381 | if ( tempheader.new_version_compilername[0] ) zprint2("Compiled with: %s, (ID: %d)\n", tempheader.new_version_compilername, tempheader.compilerid); |
| 2036 |
2/2✓ Branch 0 taken 243 times.
✓ Branch 1 taken 138 times.
|
381 | if ( tempheader.new_version_compilerversion[0] ) zprint2("Compiler Version: %s, (%d,%d,%d,%d)\n", tempheader.new_version_compilerversion,tempheader.compilerversionnumber_first,tempheader.compilerversionnumber_second,tempheader.compilerversionnumber_third,tempheader.compilerversionnumber_fourth); |
| 2037 |
2/2✓ Branch 0 taken 14 times.
✓ Branch 1 taken 367 times.
|
381 | if ( tempheader.product_name[0] ) zprint2("Project ID: %s\n", tempheader.product_name); |
| 2038 |
2/2✓ Branch 0 taken 243 times.
✓ Branch 1 taken 138 times.
|
381 | if ( tempheader.new_version_id_date_day ) zprint2("Editor Built at date and time: %d-%d-%d at @ %s %s\n", tempheader.new_version_id_date_day, tempheader.new_version_id_date_month, tempheader.new_version_id_date_year, tempheader.build_timestamp, tempheader.build_timezone); |
| 2039 | 381 | zprint2("\n"); | |
| 2040 | 381 | } | |
| 2041 | |||
| 2042 | 695 | int32_t readheader(PACKFILE *f, zquestheader *Header, byte printmetadata) | |
| 2043 | { | ||
| 2044 | int32_t dummy; | ||
| 2045 | zquestheader tempheader; | ||
| 2046 | char dummybuf[80]; | ||
| 2047 | byte temp_map_count; | ||
| 2048 | byte temp_midi_flags[MIDIFLAGS_SIZE]; | ||
| 2049 | word version; | ||
| 2050 | char temp_pwd[30], temp_pwd2[30]; | ||
| 2051 | int16_t temp_pwdkey; | ||
| 2052 | cvs_MD5Context ctx; | ||
| 2053 | 695 | memset(temp_midi_flags, 0, MIDIFLAGS_SIZE); | |
| 2054 | 695 | memset(&tempheader, 0, sizeof(tempheader)); | |
| 2055 | 695 | memset(FFCore.quest_format, 0, sizeof(FFCore.quest_format)); | |
| 2056 | |||
| 2057 | |||
| 2058 | |||
| 2059 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 695 times.
|
695 | if(!pfread(tempheader.id_str,sizeof(tempheader.id_str),f)) // first read old header |
| 2060 | { | ||
| 2061 | ✗ | Z_message("Unable to read header string\n"); | |
| 2062 | ✗ | return qe_invalid; | |
| 2063 | } | ||
| 2064 | |||
| 2065 | // check header | ||
| 2066 |
2/2✓ Branch 0 taken 671 times.
✓ Branch 1 taken 24 times.
|
695 | if(strcmp(tempheader.id_str,QH_NEWIDSTR)) |
| 2067 | { | ||
| 2068 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 24 times.
|
24 | if(strcmp(tempheader.id_str,QH_IDSTR)) |
| 2069 | { | ||
| 2070 | ✗ | Z_message("Invalid header string: '%s' (was expecting '%s' or '%s')\n", tempheader.id_str, QH_IDSTR, QH_NEWIDSTR); | |
| 2071 | ✗ | return qe_invalid; | |
| 2072 | } | ||
| 2073 | 24 | } | |
| 2074 | |||
| 2075 | 695 | int32_t templatepath_len=0; | |
| 2076 | |||
| 2077 | 695 | tempheader.external_zinfo = false; | |
| 2078 | 695 | read_zinfo = false; | |
| 2079 |
2/2✓ Branch 0 taken 671 times.
✓ Branch 1 taken 24 times.
|
695 | if(!strcmp(tempheader.id_str,QH_IDSTR)) //pre-1.93 version |
| 2080 | { | ||
| 2081 | byte padding; | ||
| 2082 | |||
| 2083 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
24 | if(!p_getc(&padding,f)) |
| 2084 | { | ||
| 2085 | ✗ | return qe_invalid; | |
| 2086 | } | ||
| 2087 | |||
| 2088 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
24 | if(!p_igetw(&tempheader.zelda_version,f)) |
| 2089 | { | ||
| 2090 | ✗ | return qe_invalid; | |
| 2091 | } | ||
| 2092 | |||
| 2093 | 24 | FFCore.quest_format[vZelda] = tempheader.zelda_version; | |
| 2094 | |||
| 2095 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 24 times.
|
24 | if(tempheader.zelda_version > ZELDA_VERSION) |
| 2096 | { | ||
| 2097 | ✗ | return qe_version; | |
| 2098 | } | ||
| 2099 | |||
| 2100 | 24 | FFCore.quest_format[vZelda] = tempheader.zelda_version; | |
| 2101 | |||
| 2102 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 24 times.
|
24 | if(strcmp(tempheader.id_str,QH_IDSTR)) |
| 2103 | { | ||
| 2104 | ✗ | return qe_invalid; | |
| 2105 | } | ||
| 2106 | |||
| 2107 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 24 times.
|
24 | if(bad_version(tempheader.zelda_version)) |
| 2108 | { | ||
| 2109 | ✗ | return qe_obsolete; | |
| 2110 | } | ||
| 2111 | |||
| 2112 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
24 | if(!p_igetw(&tempheader.internal,f)) |
| 2113 | { | ||
| 2114 | ✗ | return qe_invalid; | |
| 2115 | } | ||
| 2116 | |||
| 2117 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
24 | if(!p_getc(&tempheader.quest_number,f)) |
| 2118 | { | ||
| 2119 | ✗ | return qe_invalid; | |
| 2120 | } | ||
| 2121 | |||
| 2122 | 24 | FFCore.quest_format[qQuestNumber] = tempheader.quest_number; | |
| 2123 | |||
| 2124 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
24 | if(!pfread(&quest_rules[0],2,f)) |
| 2125 | { | ||
| 2126 | ✗ | return qe_invalid; | |
| 2127 | } | ||
| 2128 | |||
| 2129 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
24 | if(!p_getc(&temp_map_count,f)) |
| 2130 | { | ||
| 2131 | ✗ | return qe_invalid; | |
| 2132 | } | ||
| 2133 | |||
| 2134 | 24 | FFCore.quest_format[qMapCount] = temp_map_count; | |
| 2135 | |||
| 2136 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
24 | if(!p_getc(&tempheader.old_str_count,f)) |
| 2137 | { | ||
| 2138 | ✗ | return qe_invalid; | |
| 2139 | } | ||
| 2140 | |||
| 2141 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
24 | if(!p_getc(&tempheader.data_flags[ZQ_TILES],f)) |
| 2142 | { | ||
| 2143 | ✗ | return qe_invalid; | |
| 2144 | } | ||
| 2145 | |||
| 2146 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
24 | if(!pfread(temp_midi_flags,4,f)) |
| 2147 | { | ||
| 2148 | ✗ | return qe_invalid; | |
| 2149 | } | ||
| 2150 | |||
| 2151 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
24 | if(!p_getc(&tempheader.data_flags[ZQ_CHEATS2],f)) |
| 2152 | { | ||
| 2153 | ✗ | return qe_invalid; | |
| 2154 | } | ||
| 2155 | |||
| 2156 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
24 | if(!pfread(dummybuf,14,f)) |
| 2157 | { | ||
| 2158 | ✗ | return qe_invalid; | |
| 2159 | } | ||
| 2160 | |||
| 2161 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
24 | if(!pfread(&quest_rules[2],2,f)) |
| 2162 | { | ||
| 2163 | ✗ | return qe_invalid; | |
| 2164 | } | ||
| 2165 | |||
| 2166 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
24 | if(!p_getc(&dummybuf,f)) |
| 2167 | { | ||
| 2168 | ✗ | return qe_invalid; | |
| 2169 | } | ||
| 2170 | |||
| 2171 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
24 | if(!pfread(tempheader.version,9,f)) |
| 2172 | { | ||
| 2173 | ✗ | return qe_invalid; | |
| 2174 | } | ||
| 2175 | |||
| 2176 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
24 | if(!pfread(tempheader.title,sizeof(tempheader.title),f)) |
| 2177 | { | ||
| 2178 | ✗ | return qe_invalid; | |
| 2179 | } | ||
| 2180 | // These fields are expected to end in null bytes! | ||
| 2181 | 24 | tempheader.title[sizeof(tempheader.title)-1] = 0; | |
| 2182 | |||
| 2183 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
24 | if(!pfread(tempheader.author,sizeof(tempheader.author),f)) |
| 2184 | { | ||
| 2185 | ✗ | return qe_invalid; | |
| 2186 | } | ||
| 2187 | 24 | tempheader.author[sizeof(tempheader.author)-1] = 0; | |
| 2188 | |||
| 2189 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
24 | if(!p_getc(&padding,f)) |
| 2190 | { | ||
| 2191 | ✗ | return qe_invalid; | |
| 2192 | } | ||
| 2193 | |||
| 2194 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
24 | if(!p_igetw(&temp_pwdkey,f)) |
| 2195 | { | ||
| 2196 | ✗ | return qe_invalid; | |
| 2197 | } | ||
| 2198 | |||
| 2199 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
24 | if(!pfread(temp_pwd,30,f)) |
| 2200 | { | ||
| 2201 | ✗ | return qe_invalid; | |
| 2202 | } | ||
| 2203 | |||
| 2204 | 24 | get_questpwd(temp_pwd, temp_pwdkey, temp_pwd2); | |
| 2205 | 24 | cvs_MD5Init(&ctx); | |
| 2206 | 24 | cvs_MD5Update(&ctx, (const uint8_t*)temp_pwd2, (unsigned)strnlen(temp_pwd2, 30)); | |
| 2207 | 24 | cvs_MD5Final(tempheader.pwd_hash, &ctx); | |
| 2208 | |||
| 2209 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 24 times.
|
24 | if(tempheader.zelda_version < 0x177) // lacks new header stuff... |
| 2210 | { | ||
| 2211 | //memset(tempheader.minver,0,20); // char minver[9], byte build, byte foo[10] | ||
| 2212 | // Not anymore... | ||
| 2213 | ✗ | memset(tempheader.minver,0,17); | |
| 2214 | ✗ | tempheader.build=0; | |
| 2215 | ✗ | tempheader.use_keyfile=0; | |
| 2216 | ✗ | memset(tempheader.old_foo, 0, 9); | |
| 2217 | ✗ | } | |
| 2218 | else | ||
| 2219 | { | ||
| 2220 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
24 | if(!pfread(tempheader.minver,9,f)) |
| 2221 | { | ||
| 2222 | ✗ | return qe_invalid; | |
| 2223 | } | ||
| 2224 | |||
| 2225 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
24 | if(!p_getc(&tempheader.build,f)) |
| 2226 | { | ||
| 2227 | ✗ | return qe_invalid; | |
| 2228 | } | ||
| 2229 | |||
| 2230 | 24 | FFCore.quest_format[vBuild] = tempheader.build; | |
| 2231 | |||
| 2232 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
24 | if(!p_getc(&tempheader.use_keyfile,f)) |
| 2233 | { | ||
| 2234 | ✗ | return qe_invalid; | |
| 2235 | } | ||
| 2236 | |||
| 2237 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
24 | if(!pfread(dummybuf,9,f)) |
| 2238 | { | ||
| 2239 | ✗ | return qe_invalid; | |
| 2240 | } | ||
| 2241 | } // starting at minver | ||
| 2242 | |||
| 2243 |
2/2✓ Branch 0 taken 6 times.
✓ Branch 1 taken 18 times.
|
24 | if(tempheader.zelda_version < 0x187) // lacks newer header stuff... |
| 2244 | { | ||
| 2245 | 6 | memset(&quest_rules[4],0,16); // word rules3..rules10 | |
| 2246 | 6 | } | |
| 2247 | else | ||
| 2248 | { | ||
| 2249 |
1/2✓ Branch 0 taken 18 times.
✗ Branch 1 not taken.
|
18 | if(!pfread(&quest_rules[4],16,f)) // read new header additions |
| 2250 | { | ||
| 2251 | ✗ | return qe_invalid; // starting at rules3 | |
| 2252 | } | ||
| 2253 | |||
| 2254 |
2/2✓ Branch 0 taken 6 times.
✓ Branch 1 taken 12 times.
|
18 | if(tempheader.zelda_version <= 0x190) |
| 2255 | { | ||
| 2256 | 12 | set_qr(qr_MEANPLACEDTRAPS,0); | |
| 2257 | 12 | } | |
| 2258 | } | ||
| 2259 | 24 | unpack_qrs(); | |
| 2260 | |||
| 2261 |
3/4✓ Branch 0 taken 6 times.
✓ Branch 1 taken 18 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 6 times.
|
30 | if((tempheader.zelda_version < 0x192)|| |
| 2262 |
1/2✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
|
6 | ((tempheader.zelda_version == 0x192)&&(tempheader.build<149))) |
| 2263 | { | ||
| 2264 | 18 | set_qr(qr_BRKNSHLDTILES,(get_qr(qr_BRKBLSHLDS_DEP))); | |
| 2265 | 18 | set_bit(deprecated_rules,qr_BRKBLSHLDS_DEP,1); | |
| 2266 | 18 | set_qr(qr_BRKBLSHLDS_DEP,1); | |
| 2267 | 18 | } | |
| 2268 | |||
| 2269 |
2/2✓ Branch 0 taken 18 times.
✓ Branch 1 taken 6 times.
|
24 | if(tempheader.zelda_version >= 0x192) // lacks newer header stuff... |
| 2270 | { | ||
| 2271 | 6 | byte *mf=temp_midi_flags; | |
| 2272 | |||
| 2273 |
3/4✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2 times.
✓ Branch 3 taken 4 times.
|
6 | if((tempheader.zelda_version == 0x192)&&(tempheader.build<178)) |
| 2274 | { | ||
| 2275 | 4 | mf=(byte*)dummybuf; | |
| 2276 | 4 | } | |
| 2277 | |||
| 2278 |
1/2✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
|
6 | if(!pfread(mf,32,f)) // read new header additions |
| 2279 | { | ||
| 2280 | ✗ | return qe_invalid; // starting at foo2 | |
| 2281 | } | ||
| 2282 | |||
| 2283 |
1/2✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
|
6 | if(!pfread(dummybuf,18,f)) // read new header additions |
| 2284 | { | ||
| 2285 | ✗ | return qe_invalid; // starting at foo2 | |
| 2286 | } | ||
| 2287 | 6 | } | |
| 2288 | |||
| 2289 |
3/4✓ Branch 0 taken 6 times.
✓ Branch 1 taken 18 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 6 times.
|
30 | if((tempheader.zelda_version < 0x192)|| |
| 2290 |
1/2✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
|
6 | ((tempheader.zelda_version == 0x192)&&(tempheader.build<145))) |
| 2291 | { | ||
| 2292 | 18 | memset(tempheader.templatepath,0,2048); | |
| 2293 | 18 | } | |
| 2294 | else | ||
| 2295 | { | ||
| 2296 |
1/2✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
|
6 | if(!pfread(tempheader.templatepath,280,f)) // read templatepath |
| 2297 | { | ||
| 2298 | ✗ | return qe_invalid; | |
| 2299 | } | ||
| 2300 | } | ||
| 2301 | |||
| 2302 |
3/4✓ Branch 0 taken 6 times.
✓ Branch 1 taken 18 times.
✓ Branch 2 taken 6 times.
✗ Branch 3 not taken.
|
30 | if((tempheader.zelda_version < 0x192)|| |
| 2303 |
1/2✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
|
6 | ((tempheader.zelda_version == 0x192)&&(tempheader.build<186))) |
| 2304 | { | ||
| 2305 | 24 | tempheader.use_keyfile=0; | |
| 2306 | 24 | } | |
| 2307 | 24 | } | |
| 2308 | else | ||
| 2309 | { | ||
| 2310 | //section id | ||
| 2311 |
1/2✓ Branch 0 taken 671 times.
✗ Branch 1 not taken.
|
671 | if(!p_mgetl(&dummy,f)) |
| 2312 | { | ||
| 2313 | ✗ | return qe_invalid; | |
| 2314 | } | ||
| 2315 | |||
| 2316 | //section version info | ||
| 2317 |
1/2✓ Branch 0 taken 671 times.
✗ Branch 1 not taken.
|
671 | if(!p_igetw(&version,f)) |
| 2318 | { | ||
| 2319 | ✗ | return qe_invalid; | |
| 2320 | } | ||
| 2321 | |||
| 2322 | 671 | FFCore.quest_format[vHeader] = version; | |
| 2323 | |||
| 2324 |
1/2✓ Branch 0 taken 671 times.
✗ Branch 1 not taken.
|
671 | if(!p_igetw(&dummy,f)) |
| 2325 | { | ||
| 2326 | ✗ | return qe_invalid; | |
| 2327 | } | ||
| 2328 | |||
| 2329 | //section size | ||
| 2330 |
1/2✓ Branch 0 taken 671 times.
✗ Branch 1 not taken.
|
671 | if(!p_igetl(&dummy,f)) |
| 2331 | { | ||
| 2332 | ✗ | return qe_invalid; | |
| 2333 | } | ||
| 2334 | |||
| 2335 | //finally... section data | ||
| 2336 |
1/2✓ Branch 0 taken 671 times.
✗ Branch 1 not taken.
|
671 | if(!p_igetw(&tempheader.zelda_version,f)) |
| 2337 | { | ||
| 2338 | ✗ | return qe_invalid; | |
| 2339 | } | ||
| 2340 | |||
| 2341 | 671 | FFCore.quest_format[vZelda] = tempheader.zelda_version; | |
| 2342 | |||
| 2343 | //do some quick checking... | ||
| 2344 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 671 times.
|
671 | if(tempheader.zelda_version > ZELDA_VERSION) |
| 2345 | { | ||
| 2346 | ✗ | return qe_version; | |
| 2347 | } | ||
| 2348 | |||
| 2349 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 671 times.
|
671 | if(strcmp(tempheader.id_str,QH_NEWIDSTR)) |
| 2350 | { | ||
| 2351 | ✗ | return qe_invalid; | |
| 2352 | } | ||
| 2353 | |||
| 2354 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 671 times.
|
671 | if(bad_version(tempheader.zelda_version)) |
| 2355 | { | ||
| 2356 | ✗ | return qe_obsolete; | |
| 2357 | } | ||
| 2358 | |||
| 2359 |
1/2✓ Branch 0 taken 671 times.
✗ Branch 1 not taken.
|
671 | if(!p_getc(&tempheader.build,f)) |
| 2360 | { | ||
| 2361 | ✗ | return qe_invalid; | |
| 2362 | } | ||
| 2363 | |||
| 2364 | 671 | FFCore.quest_format[vBuild] = tempheader.build; | |
| 2365 | |||
| 2366 |
2/2✓ Branch 0 taken 59 times.
✓ Branch 1 taken 612 times.
|
671 | if(version<3) |
| 2367 | { | ||
| 2368 |
1/2✓ Branch 0 taken 59 times.
✗ Branch 1 not taken.
|
59 | if(!pfread(temp_pwd,30,f)) |
| 2369 | { | ||
| 2370 | ✗ | return qe_invalid; | |
| 2371 | } | ||
| 2372 | |||
| 2373 |
1/2✓ Branch 0 taken 59 times.
✗ Branch 1 not taken.
|
59 | if(!p_igetw(&temp_pwdkey,f)) |
| 2374 | { | ||
| 2375 | ✗ | return qe_invalid; | |
| 2376 | } | ||
| 2377 | |||
| 2378 | 59 | get_questpwd(temp_pwd, temp_pwdkey, temp_pwd2); | |
| 2379 | 59 | cvs_MD5Init(&ctx); | |
| 2380 | 59 | cvs_MD5Update(&ctx, (const uint8_t*)temp_pwd2, (unsigned)strnlen(temp_pwd2, 30)); | |
| 2381 | 59 | cvs_MD5Final(tempheader.pwd_hash, &ctx); | |
| 2382 | 59 | } | |
| 2383 | else | ||
| 2384 | { | ||
| 2385 |
1/2✓ Branch 0 taken 612 times.
✗ Branch 1 not taken.
|
612 | if(!pfread(tempheader.pwd_hash,sizeof(tempheader.pwd_hash),f)) |
| 2386 | { | ||
| 2387 | ✗ | return qe_invalid; | |
| 2388 | } | ||
| 2389 | } | ||
| 2390 | |||
| 2391 |
1/2✓ Branch 0 taken 671 times.
✗ Branch 1 not taken.
|
671 | if(!p_igetw(&tempheader.internal,f)) |
| 2392 | { | ||
| 2393 | ✗ | return qe_invalid; | |
| 2394 | } | ||
| 2395 | |||
| 2396 |
1/2✓ Branch 0 taken 671 times.
✗ Branch 1 not taken.
|
671 | if(!p_getc(&tempheader.quest_number,f)) |
| 2397 | { | ||
| 2398 | ✗ | return qe_invalid; | |
| 2399 | } | ||
| 2400 | |||
| 2401 | 671 | FFCore.quest_format[qQuestNumber] = tempheader.quest_number; | |
| 2402 | |||
| 2403 | 671 | size_t versz = version < 8 ? 9 : 16; | |
| 2404 |
1/2✓ Branch 0 taken 671 times.
✗ Branch 1 not taken.
|
671 | if(!pfread(tempheader.version,versz,f)) |
| 2405 | { | ||
| 2406 | ✗ | return qe_invalid; | |
| 2407 | } | ||
| 2408 | |||
| 2409 | //FFCore.quest_format[qQuestVersion] = tempheader.version; | ||
| 2410 | //needs to be copied as char[9] or stored as a s.str | ||
| 2411 |
1/2✓ Branch 0 taken 671 times.
✗ Branch 1 not taken.
|
671 | if(!pfread(tempheader.minver,versz,f)) |
| 2412 | { | ||
| 2413 | ✗ | return qe_invalid; | |
| 2414 | } | ||
| 2415 | |||
| 2416 | //FFCore.quest_format[qMinQuestVersion] = tempheader.minver; | ||
| 2417 |
1/2✓ Branch 0 taken 671 times.
✗ Branch 1 not taken.
|
671 | if(!pfread(tempheader.title,sizeof(tempheader.title),f)) |
| 2418 | { | ||
| 2419 | ✗ | return qe_invalid; | |
| 2420 | } | ||
| 2421 | 671 | tempheader.title[sizeof(tempheader.title)-1] = 0; | |
| 2422 | |||
| 2423 |
1/2✓ Branch 0 taken 671 times.
✗ Branch 1 not taken.
|
671 | if(!pfread(tempheader.author,sizeof(tempheader.author),f)) |
| 2424 | { | ||
| 2425 | ✗ | return qe_invalid; | |
| 2426 | } | ||
| 2427 | 671 | tempheader.author[sizeof(tempheader.author)-1] = 0; | |
| 2428 | |||
| 2429 |
1/2✓ Branch 0 taken 671 times.
✗ Branch 1 not taken.
|
671 | if(!p_getc(&tempheader.use_keyfile,f)) |
| 2430 | { | ||
| 2431 | ✗ | return qe_invalid; | |
| 2432 | } | ||
| 2433 | |||
| 2434 | /* | ||
| 2435 | if(!pfread(tempheader.data_flags,sizeof(tempheader.data_flags),f)) | ||
| 2436 | { | ||
| 2437 | return qe_invalid; | ||
| 2438 | } | ||
| 2439 | */ | ||
| 2440 |
1/2✓ Branch 0 taken 671 times.
✗ Branch 1 not taken.
|
671 | if(!p_getc(&tempheader.data_flags[ZQ_TILES],f)) |
| 2441 | { | ||
| 2442 | ✗ | return qe_invalid; | |
| 2443 | } | ||
| 2444 | |||
| 2445 |
1/2✓ Branch 0 taken 671 times.
✗ Branch 1 not taken.
|
671 | if(!pfread(&dummybuf,4,f)) |
| 2446 | { | ||
| 2447 | ✗ | return qe_invalid; | |
| 2448 | } | ||
| 2449 | |||
| 2450 |
1/2✓ Branch 0 taken 671 times.
✗ Branch 1 not taken.
|
671 | if(!p_getc(&tempheader.data_flags[ZQ_CHEATS2],f)) |
| 2451 | { | ||
| 2452 | ✗ | return qe_invalid; | |
| 2453 | } | ||
| 2454 | |||
| 2455 |
1/2✓ Branch 0 taken 671 times.
✗ Branch 1 not taken.
|
671 | if(!pfread(dummybuf,14,f)) |
| 2456 | { | ||
| 2457 | ✗ | return qe_invalid; | |
| 2458 | } | ||
| 2459 | |||
| 2460 | 671 | templatepath_len=sizeof(tempheader.templatepath); | |
| 2461 | |||
| 2462 |
2/2✓ Branch 0 taken 612 times.
✓ Branch 1 taken 59 times.
|
671 | if(version==1) |
| 2463 | { | ||
| 2464 | 59 | templatepath_len=280; | |
| 2465 | 59 | } | |
| 2466 | |||
| 2467 |
1/2✓ Branch 0 taken 671 times.
✗ Branch 1 not taken.
|
671 | if(!pfread(tempheader.templatepath,templatepath_len,f)) |
| 2468 | { | ||
| 2469 | ✗ | return qe_invalid; | |
| 2470 | } | ||
| 2471 | |||
| 2472 |
1/2✓ Branch 0 taken 671 times.
✗ Branch 1 not taken.
|
671 | if(!p_getc(&temp_map_count,f)) |
| 2473 | { | ||
| 2474 | ✗ | return qe_invalid; | |
| 2475 | } | ||
| 2476 | |||
| 2477 |
2/2✓ Branch 0 taken 423 times.
✓ Branch 1 taken 248 times.
|
671 | if(version>=4) |
| 2478 | { | ||
| 2479 |
1/2✓ Branch 0 taken 423 times.
✗ Branch 1 not taken.
|
423 | if(!p_igetl(&tempheader.version_major,f)) |
| 2480 | { | ||
| 2481 | ✗ | return qe_invalid; | |
| 2482 | } | ||
| 2483 |
1/2✓ Branch 0 taken 423 times.
✗ Branch 1 not taken.
|
423 | if(!p_igetl(&tempheader.version_minor,f)) |
| 2484 | { | ||
| 2485 | ✗ | return qe_invalid; | |
| 2486 | } | ||
| 2487 |
1/2✓ Branch 0 taken 423 times.
✗ Branch 1 not taken.
|
423 | if(!p_igetl(&tempheader.version_patch,f)) |
| 2488 | { | ||
| 2489 | ✗ | return qe_invalid; | |
| 2490 | } | ||
| 2491 |
1/2✓ Branch 0 taken 423 times.
✗ Branch 1 not taken.
|
423 | if(!p_igetl(&tempheader.new_version_id_fourth,f)) |
| 2492 | { | ||
| 2493 | ✗ | return qe_invalid; | |
| 2494 | } | ||
| 2495 |
1/2✓ Branch 0 taken 423 times.
✗ Branch 1 not taken.
|
423 | if(!p_igetl(&tempheader.new_version_id_alpha,f)) |
| 2496 | { | ||
| 2497 | ✗ | return qe_invalid; | |
| 2498 | } | ||
| 2499 |
1/2✓ Branch 0 taken 423 times.
✗ Branch 1 not taken.
|
423 | if(!p_igetl(&tempheader.new_version_id_beta,f)) |
| 2500 | { | ||
| 2501 | ✗ | return qe_invalid; | |
| 2502 | } | ||
| 2503 |
1/2✓ Branch 0 taken 423 times.
✗ Branch 1 not taken.
|
423 | if(!p_igetl(&tempheader.new_version_id_gamma,f)) |
| 2504 | { | ||
| 2505 | ✗ | return qe_invalid; | |
| 2506 | } | ||
| 2507 |
1/2✓ Branch 0 taken 423 times.
✗ Branch 1 not taken.
|
423 | if(!p_igetl(&tempheader.new_version_id_release,f)) |
| 2508 | { | ||
| 2509 | ✗ | return qe_invalid; | |
| 2510 | } | ||
| 2511 |
1/2✓ Branch 0 taken 423 times.
✗ Branch 1 not taken.
|
423 | if(!p_igetw(&tempheader.new_version_id_date_year,f)) |
| 2512 | { | ||
| 2513 | ✗ | return qe_invalid; | |
| 2514 | } | ||
| 2515 |
1/2✓ Branch 0 taken 423 times.
✗ Branch 1 not taken.
|
423 | if(!p_getc(&tempheader.new_version_id_date_month,f)) |
| 2516 | { | ||
| 2517 | ✗ | return qe_invalid; | |
| 2518 | } | ||
| 2519 |
1/2✓ Branch 0 taken 423 times.
✗ Branch 1 not taken.
|
423 | if(!p_getc(&tempheader.new_version_id_date_day,f)) |
| 2520 | { | ||
| 2521 | ✗ | return qe_invalid; | |
| 2522 | } | ||
| 2523 |
1/2✓ Branch 0 taken 423 times.
✗ Branch 1 not taken.
|
423 | if(!p_getc(&tempheader.new_version_id_date_hour,f)) |
| 2524 | { | ||
| 2525 | ✗ | return qe_invalid; | |
| 2526 | } | ||
| 2527 |
1/2✓ Branch 0 taken 423 times.
✗ Branch 1 not taken.
|
423 | if(!p_getc(&tempheader.new_version_id_date_minute,f)) |
| 2528 | { | ||
| 2529 | ✗ | return qe_invalid; | |
| 2530 | } | ||
| 2531 | |||
| 2532 |
1/2✓ Branch 0 taken 423 times.
✗ Branch 1 not taken.
|
423 | if(!pfread(tempheader.new_version_devsig,256,f)) |
| 2533 | { | ||
| 2534 | ✗ | return qe_invalid; | |
| 2535 | } | ||
| 2536 |
1/2✓ Branch 0 taken 423 times.
✗ Branch 1 not taken.
|
423 | if(!strcmp(tempheader.new_version_devsig, "Venrob")) |
| 2537 | ✗ | strcpy(tempheader.new_version_devsig, "EmilyV99"); | |
| 2538 |
1/2✓ Branch 0 taken 423 times.
✗ Branch 1 not taken.
|
423 | if(!pfread(tempheader.new_version_compilername,256,f)) |
| 2539 | { | ||
| 2540 | ✗ | return qe_invalid; | |
| 2541 | } | ||
| 2542 |
1/2✓ Branch 0 taken 423 times.
✗ Branch 1 not taken.
|
423 | if(!pfread(tempheader.new_version_compilerversion,256,f)) |
| 2543 | { | ||
| 2544 | ✗ | return qe_invalid; | |
| 2545 | } | ||
| 2546 |
1/2✓ Branch 0 taken 423 times.
✗ Branch 1 not taken.
|
423 | if(!pfread(tempheader.product_name,1024,f)) |
| 2547 | { | ||
| 2548 | ✗ | return qe_invalid; | |
| 2549 | } | ||
| 2550 | |||
| 2551 |
1/2✓ Branch 0 taken 423 times.
✗ Branch 1 not taken.
|
423 | if(!p_getc(&tempheader.compilerid,f)) |
| 2552 | { | ||
| 2553 | ✗ | return qe_invalid; | |
| 2554 | } | ||
| 2555 |
1/2✓ Branch 0 taken 423 times.
✗ Branch 1 not taken.
|
423 | if(!p_igetl(&tempheader.compilerversionnumber_first,f)) |
| 2556 | { | ||
| 2557 | ✗ | return qe_invalid; | |
| 2558 | } | ||
| 2559 |
1/2✓ Branch 0 taken 423 times.
✗ Branch 1 not taken.
|
423 | if(!p_igetl(&tempheader.compilerversionnumber_second,f)) |
| 2560 | { | ||
| 2561 | ✗ | return qe_invalid; | |
| 2562 | } | ||
| 2563 |
1/2✓ Branch 0 taken 423 times.
✗ Branch 1 not taken.
|
423 | if(!p_igetl(&tempheader.compilerversionnumber_third,f)) |
| 2564 | { | ||
| 2565 | ✗ | return qe_invalid; | |
| 2566 | } | ||
| 2567 |
1/2✓ Branch 0 taken 423 times.
✗ Branch 1 not taken.
|
423 | if(!p_igetl(&tempheader.compilerversionnumber_fourth,f)) |
| 2568 | { | ||
| 2569 | ✗ | return qe_invalid; | |
| 2570 | } | ||
| 2571 |
1/2✓ Branch 0 taken 423 times.
✗ Branch 1 not taken.
|
423 | if(!p_igetw(&tempheader.developerid,f)) |
| 2572 | { | ||
| 2573 | ✗ | return qe_invalid; | |
| 2574 | } | ||
| 2575 |
1/2✓ Branch 0 taken 423 times.
✗ Branch 1 not taken.
|
423 | if(!pfread(tempheader.made_in_module_name,1024,f)) |
| 2576 | { | ||
| 2577 | ✗ | return qe_invalid; | |
| 2578 | } | ||
| 2579 |
1/2✓ Branch 0 taken 423 times.
✗ Branch 1 not taken.
|
423 | if(!pfread(tempheader.build_datestamp,256,f)) |
| 2580 | { | ||
| 2581 | ✗ | return qe_invalid; | |
| 2582 | } | ||
| 2583 |
1/2✓ Branch 0 taken 423 times.
✗ Branch 1 not taken.
|
423 | if(!pfread(tempheader.build_timestamp,256,f)) |
| 2584 | { | ||
| 2585 | ✗ | return qe_invalid; | |
| 2586 | } | ||
| 2587 | 423 | } | |
| 2588 | else // <4 | ||
| 2589 | { | ||
| 2590 | 248 | tempheader.version_major = 0; | |
| 2591 | 248 | tempheader.version_minor = 0; | |
| 2592 | 248 | tempheader.version_patch = 0; | |
| 2593 | 248 | tempheader.new_version_id_fourth = 0; | |
| 2594 | 248 | tempheader.new_version_id_alpha = 0; | |
| 2595 | 248 | tempheader.new_version_id_beta = 0; | |
| 2596 | 248 | tempheader.new_version_id_gamma = 0; | |
| 2597 | 248 | tempheader.new_version_id_release = 0; | |
| 2598 | 248 | tempheader.new_version_id_date_year = 0; | |
| 2599 | 248 | tempheader.new_version_id_date_month = 0; | |
| 2600 | 248 | tempheader.new_version_id_date_day = 0; | |
| 2601 | 248 | tempheader.new_version_id_date_hour = 0; | |
| 2602 | 248 | tempheader.new_version_id_date_minute = 0; | |
| 2603 | |||
| 2604 | 248 | memset(tempheader.new_version_devsig, 0, 256); | |
| 2605 | 248 | memset(tempheader.new_version_compilername, 0, 256); | |
| 2606 | 248 | memset(tempheader.new_version_compilerversion, 0, 256); | |
| 2607 | 248 | memset(tempheader.product_name, 0, 1024); | |
| 2608 | 248 | strcpy(tempheader.product_name, "ZQuest Classic"); | |
| 2609 | |||
| 2610 | 248 | tempheader.compilerid = 0; | |
| 2611 | 248 | tempheader.compilerversionnumber_first = 0; | |
| 2612 | 248 | tempheader.compilerversionnumber_second = 0; | |
| 2613 | 248 | tempheader.compilerversionnumber_third = 0; | |
| 2614 | 248 | tempheader.compilerversionnumber_fourth = 0; | |
| 2615 | 248 | tempheader.developerid = 0; | |
| 2616 | |||
| 2617 | 248 | memset(tempheader.made_in_module_name, 0, 1024); | |
| 2618 | 248 | memset(tempheader.build_datestamp, 0, 256); | |
| 2619 | 248 | memset(tempheader.build_timestamp, 0, 256); | |
| 2620 | } | ||
| 2621 | |||
| 2622 |
2/2✓ Branch 0 taken 423 times.
✓ Branch 1 taken 248 times.
|
671 | if ( version >= 5 ) |
| 2623 | { | ||
| 2624 |
1/2✓ Branch 0 taken 423 times.
✗ Branch 1 not taken.
|
423 | if(!pfread(tempheader.build_timezone,6,f)) |
| 2625 | { | ||
| 2626 | ✗ | return qe_invalid; | |
| 2627 | } | ||
| 2628 | 423 | } | |
| 2629 | else // < 5 | ||
| 2630 | { | ||
| 2631 | 248 | memset(tempheader.build_timezone, 0, 6); | |
| 2632 | } | ||
| 2633 |
2/2✓ Branch 0 taken 248 times.
✓ Branch 1 taken 423 times.
|
671 | if ( version >= 6 ) |
| 2634 | { | ||
| 2635 | byte b; | ||
| 2636 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 423 times.
|
423 | if(!p_getc(&b,f)) |
| 2637 | { | ||
| 2638 | ✗ | return qe_invalid; | |
| 2639 | } | ||
| 2640 | 423 | tempheader.external_zinfo = b?true:false; | |
| 2641 | 423 | read_zinfo = true; | |
| 2642 | 423 | } | |
| 2643 | |||
| 2644 |
2/2✓ Branch 0 taken 423 times.
✓ Branch 1 taken 248 times.
|
671 | if(version >= 7) |
| 2645 | { | ||
| 2646 |
1/2✓ Branch 0 taken 423 times.
✗ Branch 1 not taken.
|
423 | if(!p_getc(&(tempheader.new_version_is_nightly),f)) |
| 2647 | { | ||
| 2648 | ✗ | return qe_invalid; | |
| 2649 | } | ||
| 2650 | 423 | } | |
| 2651 | else | ||
| 2652 | { | ||
| 2653 | 248 | tempheader.new_version_is_nightly = false; | |
| 2654 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 248 times.
|
248 | if(tempheader.zelda_version < 0x255) |
| 2655 | { | ||
| 2656 |
2/5✓ Branch 0 taken 59 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 189 times.
✗ Branch 4 not taken.
|
248 | switch(tempheader.zelda_version) |
| 2657 | { | ||
| 2658 | case 0x254: | ||
| 2659 | ✗ | tempheader.version_major = 2; | |
| 2660 | ✗ | tempheader.version_minor = 54; | |
| 2661 | ✗ | break; | |
| 2662 | case 0x250: | ||
| 2663 |
7/16✗ Branch 0 not taken.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✓ Branch 6 taken 28 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 24 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 6 times.
✓ Branch 11 taken 81 times.
✗ Branch 12 not taken.
✓ Branch 13 taken 16 times.
✓ Branch 14 taken 19 times.
✓ Branch 15 taken 15 times.
|
189 | switch(tempheader.build) |
| 2664 | { | ||
| 2665 | case 19: | ||
| 2666 | ✗ | tempheader.version_major = 2; | |
| 2667 | ✗ | tempheader.version_minor = 50; | |
| 2668 | ✗ | tempheader.new_version_id_gamma = 1; | |
| 2669 | ✗ | break; | |
| 2670 | case 20: | ||
| 2671 | ✗ | tempheader.version_major = 2; | |
| 2672 | ✗ | tempheader.version_minor = 50; | |
| 2673 | ✗ | tempheader.new_version_id_gamma = 2; | |
| 2674 | ✗ | break; | |
| 2675 | case 21: | ||
| 2676 | ✗ | tempheader.version_major = 2; | |
| 2677 | ✗ | tempheader.version_minor = 50; | |
| 2678 | ✗ | tempheader.new_version_id_gamma = 3; | |
| 2679 | ✗ | break; | |
| 2680 | case 22: | ||
| 2681 | ✗ | tempheader.version_major = 2; | |
| 2682 | ✗ | tempheader.version_minor = 50; | |
| 2683 | ✗ | tempheader.new_version_id_gamma = 4; | |
| 2684 | ✗ | break; | |
| 2685 | case 23: | ||
| 2686 | ✗ | tempheader.version_major = 2; | |
| 2687 | ✗ | tempheader.version_minor = 50; | |
| 2688 | ✗ | tempheader.new_version_id_gamma = 5; | |
| 2689 | ✗ | break; | |
| 2690 | case 24: | ||
| 2691 | 28 | tempheader.version_major = 2; | |
| 2692 | 28 | tempheader.version_minor = 50; | |
| 2693 | 28 | tempheader.new_version_id_release = -1; | |
| 2694 | 28 | break; | |
| 2695 | case 25: | ||
| 2696 | ✗ | tempheader.version_major = 2; | |
| 2697 | ✗ | tempheader.version_minor = 50; | |
| 2698 | ✗ | tempheader.version_patch = 1; | |
| 2699 | ✗ | tempheader.new_version_id_gamma = 1; | |
| 2700 | ✗ | break; | |
| 2701 | case 26: | ||
| 2702 | 24 | tempheader.version_major = 2; | |
| 2703 | 24 | tempheader.version_minor = 50; | |
| 2704 | 24 | tempheader.version_patch = 1; | |
| 2705 | 24 | tempheader.new_version_id_gamma = 2; | |
| 2706 | 24 | break; | |
| 2707 | case 27: | ||
| 2708 | ✗ | tempheader.version_major = 2; | |
| 2709 | ✗ | tempheader.version_minor = 50; | |
| 2710 | ✗ | tempheader.version_patch = 1; | |
| 2711 | ✗ | tempheader.new_version_id_gamma = 3; | |
| 2712 | ✗ | break; | |
| 2713 | case 28: | ||
| 2714 | 6 | tempheader.version_major = 2; | |
| 2715 | 6 | tempheader.version_minor = 50; | |
| 2716 | 6 | tempheader.version_patch = 1; | |
| 2717 | 6 | tempheader.new_version_id_release = -1; | |
| 2718 | 6 | break; | |
| 2719 | case 29: | ||
| 2720 | 81 | tempheader.version_major = 2; | |
| 2721 | 81 | tempheader.version_minor = 50; | |
| 2722 | 81 | tempheader.version_patch = 2; | |
| 2723 | 81 | tempheader.new_version_id_release = -1; | |
| 2724 | 81 | break; | |
| 2725 | case 30: | ||
| 2726 | ✗ | tempheader.version_major = 2; | |
| 2727 | ✗ | tempheader.version_minor = 50; | |
| 2728 | ✗ | tempheader.version_patch = 3; | |
| 2729 | ✗ | tempheader.new_version_id_gamma = 1; | |
| 2730 | ✗ | break; | |
| 2731 | case 31: | ||
| 2732 | 16 | tempheader.version_major = 2; | |
| 2733 | 16 | tempheader.version_minor = 53; | |
| 2734 | 16 | tempheader.new_version_id_gamma = -1; | |
| 2735 | 16 | break; | |
| 2736 | case 32: | ||
| 2737 | 19 | tempheader.version_major = 2; | |
| 2738 | 19 | tempheader.version_minor = 53; | |
| 2739 | 19 | tempheader.new_version_id_release = -1; | |
| 2740 | 19 | break; | |
| 2741 | case 33: | ||
| 2742 | 15 | tempheader.version_major = 2; | |
| 2743 | 15 | tempheader.version_minor = 53; | |
| 2744 | 15 | tempheader.version_patch = 1; | |
| 2745 | 15 | break; | |
| 2746 | } | ||
| 2747 | 189 | break; | |
| 2748 | |||
| 2749 | case 0x211: | ||
| 2750 | ✗ | tempheader.version_major = 2; | |
| 2751 | ✗ | tempheader.version_minor = 11; | |
| 2752 | ✗ | tempheader.new_version_id_beta = tempheader.build; | |
| 2753 | ✗ | break; | |
| 2754 | case 0x210: | ||
| 2755 | 59 | tempheader.version_major = 2; | |
| 2756 | 59 | tempheader.version_minor = 10; | |
| 2757 | 59 | tempheader.new_version_id_beta = tempheader.build; | |
| 2758 | 59 | break; | |
| 2759 | } | ||
| 2760 | 248 | } | |
| 2761 | } | ||
| 2762 | |||
| 2763 |
2/2✓ Branch 0 taken 105 times.
✓ Branch 1 taken 566 times.
|
671 | if (version>=9) |
| 2764 | { | ||
| 2765 | 105 | std::string version_string; | |
| 2766 |
2/4✓ Branch 0 taken 105 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 105 times.
✗ Branch 3 not taken.
|
105 | if(!p_getcstr(&version_string, f)) |
| 2767 | { | ||
| 2768 | ✗ | return qe_invalid; | |
| 2769 | } | ||
| 2770 | |||
| 2771 | 105 | strncpy(tempheader.zelda_version_string, version_string.c_str(), sizeof(tempheader.zelda_version_string)); | |
| 2772 | 105 | snprintf(tempheader.zelda_version_string, sizeof(tempheader.zelda_version_string), "%s", version_string.c_str()); | |
| 2773 |
1/3✗ Branch 0 not taken.
✗ Branch 1 not taken.
✓ Branch 2 taken 105 times.
|
105 | } |
| 2774 | else | ||
| 2775 | { | ||
| 2776 | 566 | snprintf(tempheader.zelda_version_string, sizeof(tempheader.zelda_version_string), "%d.%d.%d", tempheader.version_major, tempheader.version_minor, tempheader.version_patch); | |
| 2777 | } | ||
| 2778 | |||
| 2779 |
3/4✓ Branch 0 taken 662 times.
✓ Branch 1 taken 9 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 662 times.
|
671 | if(printmetadata || __isZQuest) |
| 2780 | { | ||
| 2781 | 9 | print_quest_metadata(tempheader, loading_qst_name, loading_qst_num); | |
| 2782 | 9 | } | |
| 2783 | } | ||
| 2784 | |||
| 2785 | //{ Version Warning | ||
| 2786 | 695 | int32_t vercmp = tempheader.compareVer(); | |
| 2787 | 695 | int32_t astatecmp = compare(int32_t(tempheader.getAlphaState()), getAlphaState()); | |
| 2788 | 695 | int32_t avercmp = compare(tempheader.getAlphaVer(), 0); | |
| 2789 |
4/6✓ Branch 0 taken 695 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 105 times.
✓ Branch 3 taken 590 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 105 times.
|
800 | if(vercmp > 0 || (!vercmp && |
| 2790 |
2/4✓ Branch 0 taken 105 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 105 times.
✗ Branch 3 not taken.
|
105 | (astatecmp > 0 || (!astatecmp && |
| 2791 | 105 | avercmp > 0)))) | |
| 2792 | { | ||
| 2793 | ✗ | bool r = true; | |
| 2794 | ✗ | if(loadquest_report) | |
| 2795 | { | ||
| 2796 | ✗ | enter_sys_pal(); | |
| 2797 | ✗ | AlertDialog("Quest saved in newer version", | |
| 2798 | "This quest was last saved in a newer version of ZQuest." | ||
| 2799 | " Attempting to load this quest may not work correctly; to" | ||
| 2800 | ✗ | " avoid issues, try loading this quest in at least '" + std::string(tempheader.getVerStr()) + "'" | |
| 2801 | "\n\nWould you like to continue loading anyway? (Not recommended)", | ||
| 2802 | ✗ | [&](bool ret,bool) | |
| 2803 | { | ||
| 2804 | ✗ | r = ret; | |
| 2805 | ✗ | }).show(); | |
| 2806 | ✗ | exit_sys_pal(); | |
| 2807 | ✗ | } | |
| 2808 | ✗ | if(!r) | |
| 2809 | ✗ | return qe_silenterr; | |
| 2810 | ✗ | } | |
| 2811 |
1/2✓ Branch 0 taken 695 times.
✗ Branch 1 not taken.
|
695 | else if(tempheader.compareDate() > 0) |
| 2812 | { | ||
| 2813 | ✗ | bool r = true; | |
| 2814 | ✗ | if(loadquest_report) | |
| 2815 | { | ||
| 2816 | ✗ | enter_sys_pal(); | |
| 2817 | ✗ | AlertDialog("Quest saved in newer build", | |
| 2818 | ✗ | fmt::format("This quest was last saved in a newer build of ZQuest, and may have" | |
| 2819 | " issues loading in this build." | ||
| 2820 | "\n{}" | ||
| 2821 | "\n\nWould you like to continue loading anyway?", | ||
| 2822 | ✗ | tempheader.getVerCmpStr()), | |
| 2823 | ✗ | [&](bool ret,bool) | |
| 2824 | { | ||
| 2825 | ✗ | r = ret; | |
| 2826 | ✗ | }).show(); | |
| 2827 | ✗ | exit_sys_pal(); | |
| 2828 | ✗ | } | |
| 2829 | ✗ | if(!r) | |
| 2830 | ✗ | return qe_silenterr; | |
| 2831 | ✗ | } | |
| 2832 | //} | ||
| 2833 | |||
| 2834 | 695 | read_ext_zinfo = tempheader.external_zinfo; | |
| 2835 | |||
| 2836 | 695 | memcpy(Header, &tempheader, sizeof(tempheader)); | |
| 2837 | 695 | map_count=temp_map_count; | |
| 2838 | 695 | memcpy(midi_flags, temp_midi_flags, MIDIFLAGS_SIZE); | |
| 2839 | |||
| 2840 | 695 | unpack_qrs(); | |
| 2841 | |||
| 2842 | 695 | return 0; | |
| 2843 | 695 | } | |
| 2844 | |||
| 2845 | 692 | int32_t readrules(PACKFILE *f, zquestheader *Header) | |
| 2846 | { | ||
| 2847 |
2/2✓ Branch 0 taken 669 times.
✓ Branch 1 taken 23 times.
|
692 | bool should_skip = legacy_skip_flags && get_bit(legacy_skip_flags, skip_rules); |
| 2848 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 692 times.
|
692 | if (should_skip) |
| 2849 | ✗ | return 0; | |
| 2850 | |||
| 2851 | int32_t dummy; | ||
| 2852 | zquestheader tempheader; | ||
| 2853 | 692 | word s_version=0; | |
| 2854 | 692 | dword compatrule_version=0; | |
| 2855 | |||
| 2856 | 692 | memcpy(&tempheader, Header, sizeof(tempheader)); | |
| 2857 | |||
| 2858 |
2/2✓ Branch 0 taken 21 times.
✓ Branch 1 taken 671 times.
|
692 | if(tempheader.zelda_version >= 0x193) |
| 2859 | { | ||
| 2860 | //section version info | ||
| 2861 |
1/2✓ Branch 0 taken 671 times.
✗ Branch 1 not taken.
|
671 | if(!p_igetw(&s_version,f)) |
| 2862 | { | ||
| 2863 | ✗ | return qe_invalid; | |
| 2864 | } | ||
| 2865 | |||
| 2866 | 671 | FFCore.quest_format[vRules] = s_version; | |
| 2867 | |||
| 2868 |
1/2✓ Branch 0 taken 671 times.
✗ Branch 1 not taken.
|
671 | if(!p_igetw(&dummy,f)) |
| 2869 | { | ||
| 2870 | ✗ | return qe_invalid; | |
| 2871 | } | ||
| 2872 | |||
| 2873 |
2/2✓ Branch 0 taken 248 times.
✓ Branch 1 taken 423 times.
|
671 | if(s_version > 16) |
| 2874 | { | ||
| 2875 |
1/2✓ Branch 0 taken 423 times.
✗ Branch 1 not taken.
|
423 | if(!p_igetl(&compatrule_version,f)) |
| 2876 | { | ||
| 2877 | ✗ | return qe_invalid; | |
| 2878 | } | ||
| 2879 | 423 | } | |
| 2880 | 671 | FFCore.quest_format[vCompatRule] = compatrule_version; | |
| 2881 | |||
| 2882 | //section size | ||
| 2883 |
1/2✓ Branch 0 taken 671 times.
✗ Branch 1 not taken.
|
671 | if(!p_igetl(&dummy,f)) |
| 2884 | { | ||
| 2885 | ✗ | return qe_invalid; | |
| 2886 | } | ||
| 2887 | |||
| 2888 |
2/2✓ Branch 0 taken 248 times.
✓ Branch 1 taken 423 times.
|
671 | if ( s_version < 15 ) |
| 2889 | { | ||
| 2890 | //finally... section data | ||
| 2891 |
1/2✓ Branch 0 taken 248 times.
✗ Branch 1 not taken.
|
248 | if(!pfread(quest_rules,QUESTRULES_SIZE,f)) |
| 2892 | { | ||
| 2893 | ✗ | return qe_invalid; | |
| 2894 | } | ||
| 2895 | 248 | } | |
| 2896 | else | ||
| 2897 | { | ||
| 2898 | |||
| 2899 |
1/2✓ Branch 0 taken 423 times.
✗ Branch 1 not taken.
|
423 | if(!pfread(quest_rules,QUESTRULES_NEW_SIZE,f)) |
| 2900 | { | ||
| 2901 | ✗ | return qe_invalid; | |
| 2902 | } | ||
| 2903 | |||
| 2904 | } | ||
| 2905 | 671 | } | |
| 2906 | |||
| 2907 | //al_trace("Rules version %d\n", s_version); | ||
| 2908 | //{ bunch of compat stuff | ||
| 2909 | 692 | memcpy(deprecated_rules, quest_rules, QUESTRULES_NEW_SIZE); | |
| 2910 | |||
| 2911 | 692 | unpack_qrs(); | |
| 2912 | |||
| 2913 |
2/2✓ Branch 0 taken 610 times.
✓ Branch 1 taken 82 times.
|
692 | if(s_version<2) |
| 2914 | { | ||
| 2915 | 82 | set_qr(14,0); | |
| 2916 | 82 | set_qr(27,0); | |
| 2917 | 82 | set_qr(28,0); | |
| 2918 | 82 | set_qr(29,0); | |
| 2919 | 82 | set_qr(30,0); | |
| 2920 | 82 | set_qr(32,0); | |
| 2921 | 82 | set_qr(36,0); | |
| 2922 | 82 | set_qr(49,0); | |
| 2923 | 82 | set_qr(50,0); | |
| 2924 | 82 | set_qr(51,0); | |
| 2925 | 82 | set_qr(68,0); | |
| 2926 | 82 | set_qr(75,0); | |
| 2927 | 82 | set_qr(76,0); | |
| 2928 | 82 | set_qr(98,0); | |
| 2929 | 82 | set_qr(110,0); | |
| 2930 | 82 | set_qr(113,0); | |
| 2931 | 82 | set_qr(116,0); | |
| 2932 | 82 | set_qr(102,0); | |
| 2933 | 82 | set_qr(132,0); | |
| 2934 | 82 | } | |
| 2935 | |||
| 2936 | //Now, do any updates... | ||
| 2937 |
5/6✓ Branch 0 taken 612 times.
✓ Branch 1 taken 80 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 612 times.
✓ Branch 4 taken 14 times.
✓ Branch 5 taken 14 times.
|
692 | if((tempheader.zelda_version < 0x211)||((tempheader.zelda_version == 0x211)&&(tempheader.build<18))) |
| 2938 | { | ||
| 2939 | 94 | set_qr(qr_SMOOTHVERTICALSCROLLING,1); | |
| 2940 | 94 | set_qr(qr_REPLACEOPENDOORS, 1); | |
| 2941 | 94 | set_qr(qr_OLDLENSORDER, 1); | |
| 2942 | 94 | set_qr(qr_NOFAIRYGUYFIRES, 1); | |
| 2943 | 94 | set_qr(qr_TRIGGERSREPEAT, 1); | |
| 2944 | 94 | } | |
| 2945 | |||
| 2946 |
5/6✓ Branch 0 taken 671 times.
✓ Branch 1 taken 21 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 671 times.
✓ Branch 4 taken 14 times.
✓ Branch 5 taken 14 times.
|
708 | if((tempheader.zelda_version < 0x193)||((tempheader.zelda_version == 0x193)&&(tempheader.build<3))) |
| 2947 | { | ||
| 2948 | 35 | set_qr(qr_WALLFLIERS,1); | |
| 2949 | 35 | } | |
| 2950 | |||
| 2951 |
5/6✓ Branch 0 taken 671 times.
✓ Branch 1 taken 21 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 671 times.
✓ Branch 4 taken 14 times.
✓ Branch 5 taken 14 times.
|
708 | if((tempheader.zelda_version < 0x193)||((tempheader.zelda_version == 0x193)&&(tempheader.build<4))) |
| 2952 | { | ||
| 2953 | 35 | set_qr(qr_NOBOMBPALFLASH,1); | |
| 2954 | 35 | } | |
| 2955 | |||
| 2956 |
5/6✓ Branch 0 taken 671 times.
✓ Branch 1 taken 21 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 671 times.
✓ Branch 4 taken 18 times.
✓ Branch 5 taken 18 times.
|
708 | if((tempheader.zelda_version < 0x193)||((tempheader.zelda_version == 0x193)&&(tempheader.build<3))) |
| 2957 | { | ||
| 2958 | 39 | set_qr(qr_NOSCROLLCONTINUE,1); | |
| 2959 | 39 | } | |
| 2960 | |||
| 2961 |
2/2✓ Branch 0 taken 606 times.
✓ Branch 1 taken 82 times.
|
712 | if(tempheader.zelda_version <= 0x210) |
| 2962 | { | ||
| 2963 | 82 | set_qr(qr_ARROWCLIP,1); | |
| 2964 | 82 | } | |
| 2965 | |||
| 2966 |
2/2✓ Branch 0 taken 629 times.
✓ Branch 1 taken 59 times.
|
688 | if(tempheader.zelda_version == 0x210) |
| 2967 | { | ||
| 2968 | 59 | set_qr(qr_NOSCROLLCONTINUE, get_qr(qr_CMBCYCLELAYERS)); | |
| 2969 | 59 | set_qr(qr_CMBCYCLELAYERS, 0); | |
| 2970 | 59 | set_qr(qr_CONT_SWORD_TRIGGERS, 1); | |
| 2971 | 59 | } | |
| 2972 | |||
| 2973 |
2/2✓ Branch 0 taken 606 times.
✓ Branch 1 taken 82 times.
|
688 | if(tempheader.zelda_version <= 0x210) |
| 2974 | { | ||
| 2975 | 82 | set_qr(qr_OLDSTYLEWARP,1); | |
| 2976 | 82 | set_qr(qr_210_WARPRETURN,1); | |
| 2977 | 82 | } | |
| 2978 | |||
| 2979 | //might not be correct | ||
| 2980 |
2/2✓ Branch 0 taken 665 times.
✓ Branch 1 taken 23 times.
|
688 | if(tempheader.zelda_version < 0x210) |
| 2981 | { | ||
| 2982 | 23 | set_bit(deprecated_rules, qr_OLDTRIBBLES_DEP,1); | |
| 2983 | 23 | set_qr(qr_OLDTRIBBLES_DEP,1); | |
| 2984 | 23 | set_qr(qr_OLDHOOKSHOTGRAB,1); | |
| 2985 | 23 | } | |
| 2986 | |||
| 2987 |
2/2✓ Branch 0 taken 606 times.
✓ Branch 1 taken 82 times.
|
688 | if(tempheader.zelda_version < 0x211) |
| 2988 | { | ||
| 2989 | 82 | set_qr(qr_WRONG_BRANG_TRAIL_DIR,1); | |
| 2990 | 82 | } | |
| 2991 | |||
| 2992 |
4/4✓ Branch 0 taken 5 times.
✓ Branch 1 taken 683 times.
✓ Branch 2 taken 17 times.
✓ Branch 3 taken 666 times.
|
688 | if((tempheader.zelda_version == 0x192 && tempheader.build <= 163) || tempheader.zelda_version < 0x192) |
| 2993 | { | ||
| 2994 | 22 | set_qr(qr_192b163_WARP,1); | |
| 2995 | 22 | } | |
| 2996 | |||
| 2997 |
2/2✓ Branch 0 taken 629 times.
✓ Branch 1 taken 59 times.
|
688 | if(tempheader.zelda_version == 0x210) |
| 2998 | { | ||
| 2999 | 59 | set_bit(deprecated_rules, qr_OLDTRIBBLES_DEP, get_qr(qr_DMGCOMBOPRI)); | |
| 3000 | 59 | set_qr(qr_OLDTRIBBLES_DEP, get_qr(qr_DMGCOMBOPRI)); | |
| 3001 | 59 | set_qr(qr_DMGCOMBOPRI, 0); | |
| 3002 | 59 | } | |
| 3003 | |||
| 3004 |
5/6✓ Branch 0 taken 612 times.
✓ Branch 1 taken 76 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 612 times.
✓ Branch 4 taken 18 times.
✓ Branch 5 taken 18 times.
|
688 | if(tempheader.zelda_version < 0x211 || (tempheader.zelda_version == 0x211 && tempheader.build<15)) |
| 3005 | { | ||
| 3006 | 94 | set_qr(qr_OLDPICKUP,1); | |
| 3007 | 94 | } | |
| 3008 | |||
| 3009 |
5/6✓ Branch 0 taken 612 times.
✓ Branch 1 taken 76 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 612 times.
✓ Branch 4 taken 18 times.
✓ Branch 5 taken 18 times.
|
712 | if(tempheader.zelda_version < 0x211 || (tempheader.zelda_version == 0x211 && tempheader.build < 18)) |
| 3010 | { | ||
| 3011 | 94 | set_qr(qr_NOSOLIDDAMAGECOMBOS, 1); | |
| 3012 | 94 | set_qr(qr_ITEMPICKUPSETSBELOW, 1); // broke around build 400 | |
| 3013 | 94 | } | |
| 3014 | |||
| 3015 |
2/2✓ Branch 0 taken 606 times.
✓ Branch 1 taken 82 times.
|
712 | if(tempheader.zelda_version < 0x250) // version<0x250 checks for beta 18; build was set to 18 prematurely |
| 3016 | { | ||
| 3017 | 82 | set_qr(qr_HOOKSHOTDOWNBUG, 1); | |
| 3018 | 82 | } | |
| 3019 | |||
| 3020 |
4/4✓ Branch 0 taken 189 times.
✓ Branch 1 taken 499 times.
✓ Branch 2 taken 161 times.
✓ Branch 3 taken 28 times.
|
688 | if(tempheader.zelda_version == 0x250 && tempheader.build == 24) // Annoying... |
| 3021 | { | ||
| 3022 | 28 | set_qr(qr_PEAHATCLOCKVULN, 1); | |
| 3023 | 28 | } | |
| 3024 | |||
| 3025 |
6/6✓ Branch 0 taken 612 times.
✓ Branch 1 taken 76 times.
✓ Branch 2 taken 189 times.
✓ Branch 3 taken 423 times.
✓ Branch 4 taken 18 times.
✓ Branch 5 taken 183 times.
|
688 | if(tempheader.zelda_version < 0x250 || (tempheader.zelda_version == 0x250 && tempheader.build < 22)) //22 is 2.50.0 RC4. Gotta set the door repair QR... -Dimi |
| 3026 | { | ||
| 3027 | 94 | set_qr(qr_OLD_DOORREPAIR, 1); | |
| 3028 | 94 | } | |
| 3029 | |||
| 3030 |
6/6✓ Branch 0 taken 612 times.
✓ Branch 1 taken 76 times.
✓ Branch 2 taken 189 times.
✓ Branch 3 taken 423 times.
✓ Branch 4 taken 18 times.
✓ Branch 5 taken 207 times.
|
688 | if(tempheader.zelda_version < 0x250 || (tempheader.zelda_version == 0x250 && tempheader.build < 20)) //20 is 2.50.0 RC1 and RC2 (cause it didn't get bumped). Okay I'm gonna be honest I have no idea if any 2.50 build was available before RC1, but gonna try and cover my ass here -Dimi |
| 3031 | { | ||
| 3032 | 94 | set_qr(qr_OLD_SECRETMONEY, 1); | |
| 3033 | 94 | } | |
| 3034 | |||
| 3035 |
6/6✓ Branch 0 taken 612 times.
✓ Branch 1 taken 100 times.
✓ Branch 2 taken 189 times.
✓ Branch 3 taken 423 times.
✓ Branch 4 taken 46 times.
✓ Branch 5 taken 155 times.
|
712 | if(tempheader.zelda_version < 0x250 || (tempheader.zelda_version == 0x250 && tempheader.build < 28)) //28 is 2.50.1 final. Potion bug might have been used, I dunno. -Dimi |
| 3036 | { | ||
| 3037 | 146 | set_qr(qr_OLD_POTION_OR_HC, 1); | |
| 3038 | 146 | } | |
| 3039 | |||
| 3040 |
6/6✓ Branch 0 taken 612 times.
✓ Branch 1 taken 100 times.
✓ Branch 2 taken 189 times.
✓ Branch 3 taken 423 times.
✓ Branch 4 taken 46 times.
✓ Branch 5 taken 155 times.
|
712 | if(tempheader.zelda_version < 0x250 || (tempheader.zelda_version == 0x250 && tempheader.build<28)) |
| 3041 | { | ||
| 3042 | 146 | set_qr(qr_OFFSCREENWEAPONS, 1); | |
| 3043 | 146 | } | |
| 3044 | |||
| 3045 | //Bombchu fix. | ||
| 3046 |
2/2✓ Branch 0 taken 523 times.
✓ Branch 1 taken 189 times.
|
712 | if(tempheader.zelda_version == 0x250) |
| 3047 | { | ||
| 3048 |
2/2✓ Branch 0 taken 161 times.
✓ Branch 1 taken 28 times.
|
189 | if ( tempheader.build == 24 ) //2.50.0 |
| 3049 | { | ||
| 3050 | 28 | set_qr(qr_BOMBCHUSUPERBOMB, 1); | |
| 3051 | 28 | } | |
| 3052 |
2/2✓ Branch 0 taken 183 times.
✓ Branch 1 taken 6 times.
|
189 | if ( tempheader.build == 28 ) //2.50.1 |
| 3053 | { | ||
| 3054 | 6 | set_qr(qr_BOMBCHUSUPERBOMB, 1); | |
| 3055 | 6 | } | |
| 3056 |
2/2✓ Branch 0 taken 108 times.
✓ Branch 1 taken 81 times.
|
189 | if ( tempheader.build == 29 ) //2.50.2 |
| 3057 | { | ||
| 3058 | 81 | set_qr(qr_BOMBCHUSUPERBOMB, 0); | |
| 3059 | 81 | } | |
| 3060 |
1/2✓ Branch 0 taken 189 times.
✗ Branch 1 not taken.
|
189 | if ( tempheader.build == 30 ) //2.50.3RC1 |
| 3061 | { | ||
| 3062 | ✗ | set_qr(qr_BOMBCHUSUPERBOMB, 0); | |
| 3063 | ✗ | } | |
| 3064 | 189 | } | |
| 3065 | |||
| 3066 |
6/6✓ Branch 0 taken 612 times.
✓ Branch 1 taken 100 times.
✓ Branch 2 taken 189 times.
✓ Branch 3 taken 423 times.
✓ Branch 4 taken 52 times.
✓ Branch 5 taken 161 times.
|
712 | if(tempheader.zelda_version < 0x250 || (tempheader.zelda_version == 0x250 && tempheader.build<29)) |
| 3067 | { | ||
| 3068 | // qr_OFFSETEWPNCOLLISIONFIX | ||
| 3069 | // All 'official' quests need this disabled. | ||
| 3070 | // All 2.10 and lower quests need this enabled to preseve compatability. | ||
| 3071 | // All 2.11 - 2.5.1 quests should have it set also, due to a bug in about half of all the betas. | ||
| 3072 | |||
| 3073 | //~Gleeok | ||
| 3074 | 152 | set_qr(qr_OFFSETEWPNCOLLISIONFIX, 1); //This has to be set!!!! | |
| 3075 | |||
| 3076 | // Broke in build 695 | ||
| 3077 |
3/4✓ Branch 0 taken 58 times.
✓ Branch 1 taken 82 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 58 times.
|
152 | if(tempheader.zelda_version>=0x211 && tempheader.build>=18) |
| 3078 | 58 | set_qr(qr_BROKENSTATUES, 1); | |
| 3079 | 140 | } | |
| 3080 |
11/14✓ Branch 0 taken 48 times.
✓ Branch 1 taken 676 times.
✓ Branch 2 taken 671 times.
✓ Branch 3 taken 5 times.
✓ Branch 4 taken 5 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 719 times.
✓ Branch 7 taken 5 times.
✓ Branch 8 taken 719 times.
✓ Branch 9 taken 5 times.
✓ Branch 10 taken 702 times.
✓ Branch 11 taken 22 times.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
|
724 | if (tempheader.zelda_version <= 0x190 || (tempheader.zelda_version == 0x192 && std::string(tempheader.title).starts_with("Zelda 3000\0"))) |
| 3081 | { | ||
| 3082 | 22 | set_qr(qr_COPIED_SWIM_SPRITES, 1); | |
| 3083 | 22 | } | |
| 3084 |
9/10✓ Branch 0 taken 189 times.
✓ Branch 1 taken 535 times.
✓ Branch 2 taken 520 times.
✓ Branch 3 taken 15 times.
✓ Branch 4 taken 438 times.
✓ Branch 5 taken 82 times.
✓ Branch 6 taken 423 times.
✓ Branch 7 taken 15 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 423 times.
|
724 | if ( (tempheader.zelda_version == 0x250 && tempheader.build < 33) || tempheader.zelda_version == 0x254 || tempheader.zelda_version < 0x250 || (tempheader.zelda_version == 0x255 && tempheader.build < 50) ) |
| 3085 | { | ||
| 3086 | 286 | set_qr(qr_OLD_SLASHNEXT_SECRETS, 1); | |
| 3087 | 286 | } | |
| 3088 | |||
| 3089 |
2/2✓ Branch 0 taken 612 times.
✓ Branch 1 taken 82 times.
|
694 | if ( (tempheader.zelda_version < 0x211) ) //2.10 water and ladder interaction |
| 3090 | { | ||
| 3091 | 82 | set_qr(qr_OLD_210_WATER, 1); | |
| 3092 | 82 | } | |
| 3093 | |||
| 3094 |
4/6✓ Branch 0 taken 423 times.
✓ Branch 1 taken 271 times.
✓ Branch 2 taken 423 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 423 times.
|
694 | if ( (tempheader.zelda_version < 0x255 ) || (tempheader.zelda_version == 0x255 && tempheader.build < 51 ) ) //2.10 water and ladder interaction |
| 3095 | { | ||
| 3096 | 271 | set_qr(qr_STEP_IS_FLOAT,0); | |
| 3097 | 271 | } | |
| 3098 | |||
| 3099 |
2/2✓ Branch 0 taken 612 times.
✓ Branch 1 taken 82 times.
|
694 | if ( tempheader.zelda_version < 0x250 ) |
| 3100 | { | ||
| 3101 | 82 | set_qr(qr_8WAY_SHOT_SFX, 1); | |
| 3102 | 82 | } | |
| 3103 | |||
| 3104 |
2/2✓ Branch 0 taken 612 times.
✓ Branch 1 taken 82 times.
|
694 | if(s_version < 3) |
| 3105 | { | ||
| 3106 | 82 | set_qr(qr_HOLDNOSTOPMUSIC, 1); | |
| 3107 | 82 | set_qr(qr_CAVEEXITNOSTOPMUSIC, 1); | |
| 3108 | 82 | } | |
| 3109 | |||
| 3110 |
2/2✓ Branch 0 taken 612 times.
✓ Branch 1 taken 82 times.
|
694 | if(s_version<4) |
| 3111 | { | ||
| 3112 | 82 | set_qr(10,0); | |
| 3113 | 82 | } | |
| 3114 | |||
| 3115 |
2/2✓ Branch 0 taken 612 times.
✓ Branch 1 taken 82 times.
|
694 | if(s_version<5) |
| 3116 | { | ||
| 3117 | 82 | set_qr(27,0); | |
| 3118 | 82 | } | |
| 3119 | |||
| 3120 |
2/2✓ Branch 0 taken 612 times.
✓ Branch 1 taken 82 times.
|
694 | if(s_version<6) |
| 3121 | { | ||
| 3122 | 82 | set_qr(46,0); | |
| 3123 | 82 | } | |
| 3124 | |||
| 3125 |
2/2✓ Branch 0 taken 612 times.
✓ Branch 1 taken 82 times.
|
694 | if(s_version<7) // January 2008 |
| 3126 | { | ||
| 3127 | 82 | set_qr(qr_HEARTSREQUIREDFIX,0); | |
| 3128 | 82 | set_qr(qr_PUSHBLOCKCSETFIX,1); | |
| 3129 | 82 | } | |
| 3130 | |||
| 3131 |
2/2✓ Branch 0 taken 82 times.
✓ Branch 1 taken 612 times.
|
694 | if(s_version<8) |
| 3132 | { | ||
| 3133 | 82 | set_qr(12, 0); | |
| 3134 | 82 | } | |
| 3135 | else | ||
| 3136 | { | ||
| 3137 | 612 | set_bit(deprecated_rules, 12, 0); | |
| 3138 | } | ||
| 3139 | |||
| 3140 |
2/2✓ Branch 0 taken 612 times.
✓ Branch 1 taken 82 times.
|
694 | if(s_version<9) // October 2008 |
| 3141 | { | ||
| 3142 | 82 | set_qr(qr_NOROPE2FLASH_DEP,0); | |
| 3143 | 82 | set_qr(qr_NOBUBBLEFLASH_DEP,0); | |
| 3144 | 82 | set_qr(qr_GHINI2BLINK_DEP,0); | |
| 3145 | 82 | set_qr(qr_PHANTOMGHINI2_DEP,0); | |
| 3146 | 82 | } | |
| 3147 | |||
| 3148 |
2/2✓ Branch 0 taken 612 times.
✓ Branch 1 taken 82 times.
|
694 | if(s_version<10) // December 2008 |
| 3149 | { | ||
| 3150 | 82 | set_qr(qr_NOCLOCKS_DEP,0); | |
| 3151 | 82 | set_qr(qr_ALLOW10RUPEEDROPS_DEP,0); | |
| 3152 | 82 | } | |
| 3153 | |||
| 3154 |
2/2✓ Branch 0 taken 612 times.
✓ Branch 1 taken 82 times.
|
694 | if(s_version<11) // April 2009 |
| 3155 | { | ||
| 3156 | 82 | set_qr(qr_SLOWENEMYANIM_DEP,0); | |
| 3157 | 82 | } | |
| 3158 | |||
| 3159 | // This served no purpose. | ||
| 3160 | // if(s_version<12) // December 2009 | ||
| 3161 | // { | ||
| 3162 | // set_qr(qr_BRKBLSHLDS_DEP,0); | ||
| 3163 | // set_qr(qr_OLDTRIBBLES_DEP,0); | ||
| 3164 | // } | ||
| 3165 | |||
| 3166 | //if(tempheader.zelda_version < 0x250 || (tempheader.zelda_version == 0x250 && tempheader.build < 24)) | ||
| 3167 |
2/2✓ Branch 0 taken 612 times.
✓ Branch 1 taken 82 times.
|
694 | if(s_version < 13) |
| 3168 | { | ||
| 3169 | 82 | set_qr(qr_SHOPCHEAT, 1); | |
| 3170 | 82 | } | |
| 3171 | |||
| 3172 | // Not entirely sure this is the best place for this... | ||
| 3173 | //2.50.2 bitmap offset fix | ||
| 3174 | 694 | memset(extra_rules, 0, EXTRARULES_SIZE); | |
| 3175 |
6/6✓ Branch 0 taken 612 times.
✓ Branch 1 taken 82 times.
✓ Branch 2 taken 189 times.
✓ Branch 3 taken 423 times.
✓ Branch 4 taken 58 times.
✓ Branch 5 taken 131 times.
|
694 | if(tempheader.zelda_version < 0x250 || (tempheader.zelda_version == 0x250 && tempheader.build<29)) |
| 3176 | { | ||
| 3177 | 140 | set_er(er_BITMAPOFFSET, 1); | |
| 3178 | 140 | set_qr(qr_BITMAPOFFSETFIX, 1); | |
| 3179 | 140 | } | |
| 3180 | //required because quest templates also used this bit, although | ||
| 3181 | //it never did anything, before. -Z | ||
| 3182 |
2/2✓ Branch 0 taken 505 times.
✓ Branch 1 taken 189 times.
|
694 | if ( tempheader.zelda_version == 0x250 ) |
| 3183 | { | ||
| 3184 |
5/6✓ Branch 0 taken 108 times.
✓ Branch 1 taken 81 times.
✓ Branch 2 taken 108 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 16 times.
✓ Branch 5 taken 92 times.
|
189 | if( tempheader.build == 29 || tempheader.build == 30 || tempheader.build == 31 ) |
| 3185 | { | ||
| 3186 | 97 | set_er(er_BITMAPOFFSET, 0); | |
| 3187 | 97 | set_qr(qr_BITMAPOFFSETFIX, 0); | |
| 3188 | 97 | } | |
| 3189 | 189 | } | |
| 3190 |
1/2✓ Branch 0 taken 694 times.
✗ Branch 1 not taken.
|
694 | if ( tempheader.zelda_version == 0x254 ) |
| 3191 | { | ||
| 3192 | ✗ | set_er(er_BITMAPOFFSET, 0); | |
| 3193 | ✗ | set_qr(qr_BITMAPOFFSETFIX, 0); | |
| 3194 | ✗ | } | |
| 3195 |
3/4✓ Branch 0 taken 423 times.
✓ Branch 1 taken 271 times.
✓ Branch 2 taken 423 times.
✗ Branch 3 not taken.
|
694 | if ( tempheader.zelda_version == 0x255 && tempheader.build < 42 ) //QR was added to 255 in this build. |
| 3196 | { | ||
| 3197 | ✗ | set_er(er_BITMAPOFFSET, 0); | |
| 3198 | ✗ | set_qr(qr_BITMAPOFFSETFIX, 0); | |
| 3199 | ✗ | } | |
| 3200 | //optimise fast drawing for older versions. | ||
| 3201 |
4/6✓ Branch 0 taken 423 times.
✓ Branch 1 taken 271 times.
✓ Branch 2 taken 423 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 423 times.
|
694 | if ( tempheader.zelda_version < 0x255 || (tempheader.zelda_version == 0x255 && tempheader.build < 42) ) |
| 3202 | { | ||
| 3203 | 271 | set_qr(qr_OLDSPRITEDRAWS, 1); | |
| 3204 | 271 | } | |
| 3205 | //Old eweapon->Parent (was added in 2.54, Alpha 19) | ||
| 3206 | //The change was made in build 43, but I'm setting this to < 42, because quests made in 42 would benefit from this change, and | ||
| 3207 | //older quests can set the rule by hand. We need a new qst.dat again. | ||
| 3208 |
4/6✓ Branch 0 taken 694 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 423 times.
✓ Branch 3 taken 271 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 423 times.
|
694 | if ( tempheader.zelda_version == 0x254 || (tempheader.zelda_version == 0x255 && tempheader.build < 42) ) |
| 3209 | { | ||
| 3210 | ✗ | set_qr(qr_OLDEWPNPARENT, 1); | |
| 3211 | ✗ | } | |
| 3212 |
4/6✓ Branch 0 taken 694 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 423 times.
✓ Branch 3 taken 271 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 423 times.
|
694 | if ( tempheader.zelda_version == 0x254 || (tempheader.zelda_version == 0x255 && tempheader.build < 44) ) |
| 3213 | { | ||
| 3214 | ✗ | set_qr(qr_OLDCREATEBITMAP_ARGS, 1); | |
| 3215 | ✗ | } | |
| 3216 |
4/6✓ Branch 0 taken 694 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 423 times.
✓ Branch 3 taken 271 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 423 times.
|
694 | if ( tempheader.zelda_version == 0x254 || (tempheader.zelda_version == 0x255 && tempheader.build < 45) ) |
| 3217 | { | ||
| 3218 | ✗ | set_qr(qr_OLDQUESTMISC, 1); | |
| 3219 | ✗ | } | |
| 3220 |
2/2✓ Branch 0 taken 423 times.
✓ Branch 1 taken 271 times.
|
694 | if ( tempheader.zelda_version < 0x254 ) |
| 3221 | { | ||
| 3222 | 271 | set_qr(qr_OLDCREATEBITMAP_ARGS, 0); | |
| 3223 | 271 | set_qr(qr_OLDEWPNPARENT, 0); | |
| 3224 | 271 | set_qr(qr_OLDQUESTMISC, 0); | |
| 3225 | 271 | } | |
| 3226 | |||
| 3227 | //item scripts continue to run | ||
| 3228 |
4/6✓ Branch 0 taken 423 times.
✓ Branch 1 taken 271 times.
✓ Branch 2 taken 423 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 423 times.
|
694 | if ( tempheader.zelda_version < 0x255 || (tempheader.zelda_version == 0x255 && tempheader.build < 44) ) |
| 3229 | { | ||
| 3230 | 271 | set_qr(qr_ITEMSCRIPTSKEEPRUNNING, 0); | |
| 3231 | 271 | set_qr(qr_SCRIPTSRUNINHEROSTEPFORWARD, 0); | |
| 3232 | 271 | set_qr(qr_FIXSCRIPTSDURINGSCROLLING, 0); | |
| 3233 | 271 | set_qr(qr_SCRIPTDRAWSINWARPS, 0); | |
| 3234 | 271 | set_qr(qr_DYINGENEMYESDONTHURTHERO, 0); | |
| 3235 | 271 | set_qr(qr_OUTOFBOUNDSENEMIES, 0); | |
| 3236 | 271 | set_qr(qr_SPRITEXY_IS_FLOAT, 0); | |
| 3237 | 271 | } | |
| 3238 | |||
| 3239 |
4/6✓ Branch 0 taken 423 times.
✓ Branch 1 taken 271 times.
✓ Branch 2 taken 423 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 423 times.
|
694 | if ( tempheader.zelda_version < 0x255 || (tempheader.zelda_version == 0x255 && tempheader.build < 46) ) |
| 3240 | { | ||
| 3241 | 271 | set_qr(qr_CLEARINITDONSCRIPTCHANGE, 1); | |
| 3242 | 271 | } | |
| 3243 |
4/6✓ Branch 0 taken 423 times.
✓ Branch 1 taken 271 times.
✓ Branch 2 taken 423 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 423 times.
|
694 | if ( tempheader.zelda_version < 0x255 || (tempheader.zelda_version == 0x255 && tempheader.build < 46) ) |
| 3244 | { | ||
| 3245 | 271 | set_qr(qr_TRACESCRIPTIDS, 0); | |
| 3246 | 271 | set_qr(qr_SCRIPT_FRIENDLY_ENEMY_TYPES, 1); | |
| 3247 | 271 | set_qr(qr_PARSER_BOOL_TRUE_DECIMAL, 1); | |
| 3248 | 271 | set_qr(qr_PARSER_250DIVISION,1); | |
| 3249 | 271 | set_qr(qr_PARSER_BOOL_TRUE_DECIMAL,1); | |
| 3250 | 271 | set_qr(qr_PARSER_TRUE_INT_SIZE,0); | |
| 3251 | 271 | set_qr(qr_PARSER_FORCE_INLINE,0); | |
| 3252 | 271 | set_qr(qr_PARSER_BINARY_32BIT,0); | |
| 3253 |
2/2✓ Branch 0 taken 264 times.
✓ Branch 1 taken 7 times.
|
271 | if ( get_qr(qr_SELECTAWPN) ) |
| 3254 | { | ||
| 3255 | 7 | set_qr(qr_NO_L_R_BUTTON_INVENTORY_SWAP,1); | |
| 3256 | //In < 2.55a27, if you had an A+B subscreen, L and R didn't shift through inventory. | ||
| 3257 | //Now they **do**, unless you disable that behaviour. | ||
| 3258 | //For the sake of compatibility, old quests with the A+B subscreen rule enabed | ||
| 3259 | //now enable the disable L/R item swap on load. | ||
| 3260 | 7 | } | |
| 3261 | |||
| 3262 | 271 | } | |
| 3263 |
4/6✓ Branch 0 taken 423 times.
✓ Branch 1 taken 271 times.
✓ Branch 2 taken 423 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 423 times.
|
694 | if ( tempheader.zelda_version < 0x255 || (tempheader.zelda_version == 0x255 && tempheader.build < 47) ) |
| 3264 | { | ||
| 3265 | //Compatibility: Setting the hero's action to rafting was previously disallowed, though legal for scripts to attempt. | ||
| 3266 | 271 | set_qr(qr_DISALLOW_SETTING_RAFTING, 1); | |
| 3267 | //Compatibility: The calculation for when to loop an animation did not factor in ASkipY correctly, resulting in | ||
| 3268 | //animations ending earlier than they should. | ||
| 3269 | 271 | set_qr(qr_BROKEN_ASKIP_Y_FRAMES, 1); | |
| 3270 | //Enemies would ignore solidity on the top half of combos | ||
| 3271 | 271 | set_qr(qr_ENEMY_BROKEN_TOP_HALF_SOLIDITY, 1); | |
| 3272 | //Ceiling collison was a bit wonky, including hitting your head before you are near the ceiling or clipping into it slightly. | ||
| 3273 | 271 | set_qr(qr_OLD_SIDEVIEW_CEILING_COLLISON, 1); | |
| 3274 | //If an itemdata had a 'frames' of 0, items created of that data would ignore all changes to 'frames' | ||
| 3275 | 271 | set_qr(qr_0AFRAME_ITEMS_IGNORE_AFRAME_CHANGES, 1); | |
| 3276 | //Collision used some odd calculations before, and enemies could not be hit back into the top row or left column | ||
| 3277 | 271 | set_qr(qr_OLD_ENEMY_KNOCKBACK_COLLISION, 1); | |
| 3278 | 271 | } | |
| 3279 |
2/2✓ Branch 0 taken 423 times.
✓ Branch 1 taken 271 times.
|
694 | if ( tempheader.zelda_version < 0x255 ) |
| 3280 | { | ||
| 3281 | 271 | set_qr(qr_NOFFCWAITDRAW, 1); | |
| 3282 | 271 | set_qr(qr_NOITEMWAITDRAW, 1); | |
| 3283 | 271 | set_qr(qr_SETENEMYWEAPONSPRITESONWPNCHANGE, 1); | |
| 3284 | 271 | set_qr(qr_OLD_INIT_SCRIPT_TIMING, 1); | |
| 3285 | //set_qr(qr_DO_NOT_DEALLOCATE_INIT_AND_SAVELOAD_ARRAYS, 1); | ||
| 3286 | 271 | } | |
| 3287 |
4/6✓ Branch 0 taken 423 times.
✓ Branch 1 taken 271 times.
✓ Branch 2 taken 423 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 423 times.
|
694 | if ( tempheader.zelda_version < 0x255 || ( tempheader.zelda_version == 0x255 && tempheader.build < 48 ) ) |
| 3288 | { | ||
| 3289 | 271 | set_qr(qr_SETENEMYWEAPONSPRITESONWPNCHANGE, 1); | |
| 3290 | 271 | } | |
| 3291 |
4/6✓ Branch 0 taken 423 times.
✓ Branch 1 taken 271 times.
✓ Branch 2 taken 423 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 423 times.
|
694 | if( tempheader.zelda_version < 0x255 || ( tempheader.zelda_version == 0x255 && tempheader.build < 52 ) ) |
| 3292 | { | ||
| 3293 | 271 | set_qr(qr_OLD_PRINTF_ARGS, 1); | |
| 3294 | 271 | } | |
| 3295 | |||
| 3296 | |||
| 3297 |
4/6✓ Branch 0 taken 423 times.
✓ Branch 1 taken 271 times.
✓ Branch 2 taken 423 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 423 times.
|
694 | if ( tempheader.zelda_version < 0x255 || (tempheader.zelda_version == 0x255 && tempheader.build < 54) ) |
| 3298 | { | ||
| 3299 | 271 | set_qr(qr_BROKEN_RING_POWER, 1); | |
| 3300 | 271 | } | |
| 3301 |
4/6✓ Branch 0 taken 423 times.
✓ Branch 1 taken 271 times.
✓ Branch 2 taken 423 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 423 times.
|
694 | if ( tempheader.zelda_version < 0x255 || (tempheader.zelda_version == 0x255 && tempheader.build < 56) ) |
| 3302 | { | ||
| 3303 | 271 | set_qr(qr_NO_OVERWORLD_MAP_CHARTING, 1); | |
| 3304 | 271 | } | |
| 3305 |
4/6✓ Branch 0 taken 423 times.
✓ Branch 1 taken 271 times.
✓ Branch 2 taken 423 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 423 times.
|
694 | if ( tempheader.zelda_version < 0x255 || (tempheader.zelda_version == 0x255 && tempheader.build < 57) ) |
| 3306 | { | ||
| 3307 | 271 | set_qr(qr_DUNGEONS_USE_CLASSIC_CHARTING, 1); | |
| 3308 | 271 | } | |
| 3309 |
4/6✓ Branch 0 taken 423 times.
✓ Branch 1 taken 271 times.
✓ Branch 2 taken 423 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 423 times.
|
694 | if ( tempheader.zelda_version < 0x255 || (tempheader.zelda_version == 0x255 && tempheader.build < 58) ) |
| 3310 | { | ||
| 3311 | //Rule used to be 'qr_SETXYBUTTONITEMS', now split. | ||
| 3312 |
1/2✓ Branch 0 taken 271 times.
✗ Branch 1 not taken.
|
271 | if(get_qr(qr_SET_XBUTTON_ITEMS)) |
| 3313 | ✗ | set_qr(qr_SET_YBUTTON_ITEMS,1); | |
| 3314 | 271 | } | |
| 3315 |
4/6✓ Branch 0 taken 423 times.
✓ Branch 1 taken 271 times.
✓ Branch 2 taken 423 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 423 times.
|
694 | if ( tempheader.zelda_version < 0x255 || (tempheader.zelda_version == 0x255 && tempheader.build < 59) ) |
| 3316 | { | ||
| 3317 | 271 | set_qr(qr_ALLOW_EDITING_COMBO_0,1); | |
| 3318 | 271 | } | |
| 3319 |
4/6✓ Branch 0 taken 423 times.
✓ Branch 1 taken 271 times.
✓ Branch 2 taken 423 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 423 times.
|
694 | if ( tempheader.zelda_version < 0x255 || (tempheader.zelda_version == 0x255 && tempheader.build < 60) ) |
| 3320 | { | ||
| 3321 | 271 | set_qr(qr_OLD_CHEST_COLLISION,1); | |
| 3322 | 271 | } | |
| 3323 | |||
| 3324 |
2/2✓ Branch 0 taken 423 times.
✓ Branch 1 taken 271 times.
|
694 | if ( tempheader.zelda_version < 0x254 ) |
| 3325 | { | ||
| 3326 | 271 | set_qr(qr_250WRITEEDEFSCRIPT, 1); | |
| 3327 | 271 | } | |
| 3328 | //Sideview spikes in 2.50.0 | ||
| 3329 |
6/6✓ Branch 0 taken 612 times.
✓ Branch 1 taken 82 times.
✓ Branch 2 taken 189 times.
✓ Branch 3 taken 423 times.
✓ Branch 4 taken 52 times.
✓ Branch 5 taken 137 times.
|
694 | if(tempheader.zelda_version < 0x250 || (tempheader.zelda_version == 0x250 && tempheader.build<27)) //2.50.1RC3 |
| 3330 | { | ||
| 3331 | 134 | set_qr(qr_OLDSIDEVIEWSPIKES, 1); | |
| 3332 | 134 | } | |
| 3333 | //more 2.50 fixes -Z | ||
| 3334 |
6/6✓ Branch 0 taken 612 times.
✓ Branch 1 taken 82 times.
✓ Branch 2 taken 189 times.
✓ Branch 3 taken 423 times.
✓ Branch 4 taken 139 times.
✓ Branch 5 taken 50 times.
|
694 | if(tempheader.zelda_version < 0x250 || (tempheader.zelda_version == 0x250 && tempheader.build<31)) |
| 3335 | { | ||
| 3336 | 221 | set_qr(qr_MELEEMAGICCOST, 0); | |
| 3337 | 221 | set_qr(qr_GANONINTRO, 0); //This will get flipped later on in the compatrule 11 check. That's why it's turning it off. | |
| 3338 | 221 | set_qr(qr_OLDMIRRORCOMBOS, 1); | |
| 3339 | 221 | set_qr(qr_BROKENBOOKCOST, 1); | |
| 3340 | 221 | set_qr(qr_BROKENCHARINTDRAWING, 1); | |
| 3341 | |||
| 3342 | 221 | } | |
| 3343 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 694 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
694 | if(tempheader.zelda_version == 0x254 && tempheader.build<41) |
| 3344 | { | ||
| 3345 | //set_qr(qr_MELEEMAGICCOST, get_er(er_MAGICCOSTSWORD)); | ||
| 3346 | ✗ | set_qr(qr_MELEEMAGICCOST, 1); | |
| 3347 | ✗ | } | |
| 3348 | |||
| 3349 |
2/2✓ Branch 0 taken 671 times.
✓ Branch 1 taken 23 times.
|
694 | if(tempheader.zelda_version < 0x193) |
| 3350 | { | ||
| 3351 | 23 | set_qr(qr_SHORTDGNWALK, 1); | |
| 3352 | 23 | } | |
| 3353 | |||
| 3354 |
2/2✓ Branch 0 taken 423 times.
✓ Branch 1 taken 271 times.
|
694 | if(tempheader.zelda_version < 0x255) |
| 3355 | { | ||
| 3356 | 271 | set_qr(qr_OLDINFMAGIC, 1); | |
| 3357 | 271 | } | |
| 3358 | |||
| 3359 |
2/2✓ Branch 0 taken 612 times.
✓ Branch 1 taken 82 times.
|
694 | if((tempheader.zelda_version < 0x250)) //2.10 and earlier allowed the triforce to Warp Player out of Item Cellars in Dungeons. -Z (15th March, 2019 ) |
| 3360 | { | ||
| 3361 | 82 | set_qr(qr_SIDEVIEWTRIFORCECELLAR,1); | |
| 3362 | 82 | } | |
| 3363 | |||
| 3364 |
4/6✓ Branch 0 taken 423 times.
✓ Branch 1 taken 271 times.
✓ Branch 2 taken 423 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 423 times.
|
694 | if ( tempheader.zelda_version < 0x255 || (tempheader.zelda_version == 0x255 && tempheader.build < 47) ) |
| 3365 | { | ||
| 3366 | 271 | set_qr(qr_OLD_F6,1); | |
| 3367 | 271 | } | |
| 3368 |
4/6✓ Branch 0 taken 423 times.
✓ Branch 1 taken 271 times.
✓ Branch 2 taken 423 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 423 times.
|
694 | if ( tempheader.zelda_version < 0x255 || (tempheader.zelda_version == 0x255 && tempheader.build < 49) ) |
| 3369 | { | ||
| 3370 | 271 | set_qr(qr_NO_OVERWRITING_HOPPING,1); | |
| 3371 | 271 | } | |
| 3372 |
4/6✓ Branch 0 taken 423 times.
✓ Branch 1 taken 271 times.
✓ Branch 2 taken 423 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 423 times.
|
694 | if ( tempheader.zelda_version < 0x255 || (tempheader.zelda_version == 0x255 && tempheader.build < 50) ) |
| 3373 | { | ||
| 3374 | 271 | set_qr(qr_STRING_FRAME_OLD_WIDTH_HEIGHT,1); | |
| 3375 | 271 | } | |
| 3376 |
4/6✓ Branch 0 taken 423 times.
✓ Branch 1 taken 271 times.
✓ Branch 2 taken 423 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 423 times.
|
694 | if ( tempheader.zelda_version < 0x255 || (tempheader.zelda_version == 0x255 && tempheader.build < 53) ) |
| 3377 | { | ||
| 3378 | 271 | set_qr(qr_BROKEN_OVERWORLD_MINIMAP,1); | |
| 3379 | 271 | } | |
| 3380 | //} | ||
| 3381 | |||
| 3382 |
2/2✓ Branch 0 taken 423 times.
✓ Branch 1 taken 271 times.
|
694 | if(compatrule_version < 1) //Enemies->Secret only affects flag 16-31 |
| 3383 | 271 | set_qr(qr_ENEMIES_SECRET_ONLY_16_31,1); | |
| 3384 | |||
| 3385 |
2/2✓ Branch 0 taken 423 times.
✓ Branch 1 taken 271 times.
|
694 | if(compatrule_version < 2) //Old CSet2 Handling |
| 3386 | 271 | set_qr(qr_OLDCS2,1); | |
| 3387 | |||
| 3388 |
2/2✓ Branch 0 taken 423 times.
✓ Branch 1 taken 271 times.
|
694 | if(compatrule_version < 3) //Hardcoded Shadow/Spawn/Death anim frames |
| 3389 | 271 | set_qr(qr_HARDCODED_ENEMY_ANIMS,1); | |
| 3390 | |||
| 3391 |
2/2✓ Branch 0 taken 423 times.
✓ Branch 1 taken 271 times.
|
694 | if(compatrule_version < 4) //Hardcoded Shadow/Spawn/Death anim frames |
| 3392 | 271 | set_qr(qr_OLD_ITEMDATA_SCRIPT_TIMING,1); | |
| 3393 | |||
| 3394 |
4/4✓ Branch 0 taken 271 times.
✓ Branch 1 taken 423 times.
✓ Branch 2 taken 82 times.
✓ Branch 3 taken 189 times.
|
694 | if(compatrule_version < 5 && tempheader.zelda_version >= 0x250) //Hardcoded Shadow/Spawn/Death anim frames |
| 3395 | 189 | set_qr(qr_NO_LANMOLA_RINGLEADER,1); | |
| 3396 | |||
| 3397 |
2/2✓ Branch 0 taken 423 times.
✓ Branch 1 taken 271 times.
|
694 | if(compatrule_version < 6) //Step->Secret (Temp) only affects flag 16-31 |
| 3398 | 271 | set_qr(qr_STEPTEMP_SECRET_ONLY_16_31,1); | |
| 3399 | |||
| 3400 |
2/2✓ Branch 0 taken 423 times.
✓ Branch 1 taken 271 times.
|
694 | if(compatrule_version < 7) //'Hit All Triggers->Perm Secret' doesn't trigger temp secrets |
| 3401 | 271 | set_qr(qr_ALLTRIG_PERMSEC_NO_TEMP,1); | |
| 3402 | |||
| 3403 |
2/2✓ Branch 0 taken 423 times.
✓ Branch 1 taken 271 times.
|
694 | if(compatrule_version < 8) //Hardcoded LItem/Bomb/Clock/Magic Tile Mods |
| 3404 | 271 | set_qr(qr_HARDCODED_LITEM_LTMS,1); | |
| 3405 | |||
| 3406 |
2/2✓ Branch 0 taken 423 times.
✓ Branch 1 taken 271 times.
|
694 | if(compatrule_version < 9) |
| 3407 | { | ||
| 3408 | //Hardcoded BS Patras | ||
| 3409 | 271 | set_qr(qr_HARDCODED_BS_PATRA,1); | |
| 3410 | //Hardcoded Patra Inner Eye offsets | ||
| 3411 | 271 | set_qr(qr_PATRAS_USE_HARDCODED_OFFSETS,1); | |
| 3412 | //Broken 'Big enemy' animation style | ||
| 3413 | 271 | set_qr(qr_BROKEN_BIG_ENEMY_ANIMATION,1); | |
| 3414 | //Broken Attribute 31/32 | ||
| 3415 | 271 | set_qr(qr_BROKEN_ATTRIBUTE_31_32,1); | |
| 3416 | 271 | } | |
| 3417 | |||
| 3418 |
2/2✓ Branch 0 taken 423 times.
✓ Branch 1 taken 271 times.
|
694 | if(compatrule_version < 10) //Shared candle use limits |
| 3419 | 271 | set_qr(qr_CANDLES_SHARED_LIMIT,1); | |
| 3420 | |||
| 3421 |
2/2✓ Branch 0 taken 423 times.
✓ Branch 1 taken 271 times.
|
694 | if(compatrule_version < 11) //No cross-screen return points |
| 3422 | 271 | set_qr(qr_OLD_RESPAWN_POINTS,1); | |
| 3423 | |||
| 3424 |
2/2✓ Branch 0 taken 423 times.
✓ Branch 1 taken 271 times.
|
694 | if(compatrule_version < 12) |
| 3425 | { | ||
| 3426 | //Old fire trail duration | ||
| 3427 | 271 | set_qr(qr_OLD_FLAMETRAIL_DURATION,1); | |
| 3428 | //Old Intro String in Ganon Room Behavior | ||
| 3429 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 271 times.
|
271 | if(get_qr(qr_GANONINTRO)) set_qr(qr_GANONINTRO,0); |
| 3430 | 271 | else set_qr(qr_GANONINTRO,1); | |
| 3431 | 271 | } | |
| 3432 | |||
| 3433 |
3/4✓ Branch 0 taken 271 times.
✓ Branch 1 taken 423 times.
✓ Branch 2 taken 271 times.
✗ Branch 3 not taken.
|
694 | if(compatrule_version < 13 && tempheader.zelda_version >= 0x255) //ANone doesn't reset to originaltile |
| 3434 | ✗ | set_qr(qr_ANONE_NOANIM,1); | |
| 3435 | |||
| 3436 |
2/2✓ Branch 0 taken 423 times.
✓ Branch 1 taken 271 times.
|
694 | if(compatrule_version < 14) //Old Bridge Combo Behavior |
| 3437 | 271 | set_qr(qr_OLD_BRIDGE_COMBOS,1); | |
| 3438 | |||
| 3439 |
2/2✓ Branch 0 taken 423 times.
✓ Branch 1 taken 271 times.
|
694 | if(compatrule_version < 15) //Broken Z3 Animation |
| 3440 | 271 | set_qr(qr_BROKEN_Z3_ANIMATION,1); | |
| 3441 | |||
| 3442 |
2/2✓ Branch 0 taken 423 times.
✓ Branch 1 taken 271 times.
|
694 | if(compatrule_version < 16) //Old Enemy Tile Behavior with Animation (None) Enemies |
| 3443 | 271 | set_qr(qr_OLD_TILE_INITIALIZATION,1); | |
| 3444 | |||
| 3445 |
2/2✓ Branch 0 taken 423 times.
✓ Branch 1 taken 271 times.
|
694 | if(compatrule_version < 17) |
| 3446 | { | ||
| 3447 | //Old Quake/DrawYOffset behavior | ||
| 3448 | //set_qr(qr_OLD_DRAWOFFSET,1); | ||
| 3449 | //I'm leaving this commented cause I doubt it'll break anything and I think the bugfix might be appreciated in older versions. | ||
| 3450 | //On the offchance that it *does* break old quests, fixing it is as simple as uncommenting the set_bit above. | ||
| 3451 | 271 | } | |
| 3452 | |||
| 3453 |
2/2✓ Branch 0 taken 423 times.
✓ Branch 1 taken 271 times.
|
694 | if(compatrule_version < 18) |
| 3454 | { | ||
| 3455 | //Broken DrawScreen Derivative Functions | ||
| 3456 | 271 | set_qr(qr_BROKEN_DRAWSCREEN_FUNCTIONS,1); | |
| 3457 | //Scrolling Cancels Charge | ||
| 3458 | 271 | set_qr(qr_SCROLLING_KILLS_CHARGE,1); | |
| 3459 | 271 | } | |
| 3460 | |||
| 3461 |
2/2✓ Branch 0 taken 423 times.
✓ Branch 1 taken 271 times.
|
694 | if(compatrule_version < 19) //Broken Enemy Item Carrying with Large Enemies |
| 3462 | 271 | set_qr(qr_BROKEN_ITEM_CARRYING,1); | |
| 3463 | |||
| 3464 |
2/2✓ Branch 0 taken 423 times.
✓ Branch 1 taken 271 times.
|
694 | if(compatrule_version < 20) |
| 3465 | 271 | set_qr(qr_CUSTOMWEAPON_IGNORE_COST,1); | |
| 3466 | |||
| 3467 |
2/2✓ Branch 0 taken 423 times.
✓ Branch 1 taken 271 times.
|
694 | if(compatrule_version < 21) |
| 3468 | { | ||
| 3469 | 271 | set_qr(qr_LEEVERS_DONT_OBEY_STUN,1); | |
| 3470 | 271 | set_qr(qr_GANON_CANT_SPAWN_ON_CONTINUE,1); | |
| 3471 | 271 | set_qr(qr_WIZZROBES_DONT_OBEY_STUN,1); | |
| 3472 | 271 | set_qr(qr_OLD_BUG_NET,1); | |
| 3473 | 271 | set_qr(qr_MANHANDLA_BLOCK_SFX,1); | |
| 3474 | 271 | } | |
| 3475 | |||
| 3476 |
2/2✓ Branch 0 taken 423 times.
✓ Branch 1 taken 271 times.
|
694 | if(compatrule_version < 22) |
| 3477 | 271 | set_qr(qr_BROKEN_KEEPOLD_FLAG,1); | |
| 3478 | |||
| 3479 |
2/2✓ Branch 0 taken 423 times.
✓ Branch 1 taken 271 times.
|
694 | if(compatrule_version < 23) |
| 3480 | 271 | set_qr(qr_OLD_HALF_MAGIC,1); | |
| 3481 | |||
| 3482 |
2/2✓ Branch 0 taken 423 times.
✓ Branch 1 taken 271 times.
|
694 | if(compatrule_version < 24) |
| 3483 | { | ||
| 3484 | 271 | set_qr(qr_WARPS_RESTART_DMAPSCRIPT,1); | |
| 3485 | 271 | set_qr(qr_DMAP_0_CONTINUE_BUG,1); | |
| 3486 | 271 | } | |
| 3487 | |||
| 3488 |
2/2✓ Branch 0 taken 423 times.
✓ Branch 1 taken 271 times.
|
694 | if(compatrule_version < 25) |
| 3489 | { | ||
| 3490 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 271 times.
|
271 | if (get_qr(qr_OLD_FAIRY_LIMIT)) set_qr(qr_OLD_FAIRY_LIMIT,0); |
| 3491 | 271 | else set_qr(qr_OLD_FAIRY_LIMIT,1); | |
| 3492 | 271 | set_qr(qr_OLD_SCRIPTED_KNOCKBACK,1); | |
| 3493 | 271 | } | |
| 3494 |
2/2✓ Branch 0 taken 423 times.
✓ Branch 1 taken 271 times.
|
694 | if(compatrule_version < 26) |
| 3495 | { | ||
| 3496 | 271 | set_qr(qr_OLD_KEESE_Z_AXIS,1); | |
| 3497 | 271 | set_qr(qr_POLVIRE_NO_SHADOW,1); | |
| 3498 | 271 | set_qr(qr_SUBSCR_OLD_SELECTOR,1); | |
| 3499 | 271 | } | |
| 3500 |
2/2✓ Branch 0 taken 423 times.
✓ Branch 1 taken 271 times.
|
694 | if(compatrule_version < 27) //Noticed some junk data in the QR array... |
| 3501 | { | ||
| 3502 |
2/2✓ Branch 0 taken 81571 times.
✓ Branch 1 taken 271 times.
|
81842 | for(auto q = qr_POLVIRE_NO_SHADOW+1; q < qr_PARSER_250DIVISION; ++q) |
| 3503 | 81571 | set_qr(q,0); | |
| 3504 |
2/2✓ Branch 0 taken 542 times.
✓ Branch 1 taken 271 times.
|
813 | for(auto q = qr_COMBODATA_INITD_MULT_TENK+1; q < qr_MAX; ++q) |
| 3505 | 542 | set_qr(q,0); | |
| 3506 | //This should nuke any remaining junk data... not sure if it affected anything previous. -Em | ||
| 3507 | 271 | } | |
| 3508 |
2/2✓ Branch 0 taken 418 times.
✓ Branch 1 taken 276 times.
|
694 | if(compatrule_version < 28) |
| 3509 | 276 | set_qr(qr_SUBSCR_BACKWARDS_ID_ORDER,1); | |
| 3510 |
2/2✓ Branch 0 taken 418 times.
✓ Branch 1 taken 276 times.
|
694 | if(compatrule_version < 29) |
| 3511 | 276 | set_qr(qr_OLD_LOCKBLOCK_COLLISION,1); | |
| 3512 |
2/2✓ Branch 0 taken 418 times.
✓ Branch 1 taken 276 times.
|
694 | if(compatrule_version < 30) |
| 3513 | { | ||
| 3514 | 276 | set_qr(qr_DECO_2_YOFFSET,1); | |
| 3515 | 276 | set_qr(qr_SCREENSTATE_80s_BUG,1); | |
| 3516 | 276 | } | |
| 3517 |
2/2✓ Branch 0 taken 418 times.
✓ Branch 1 taken 276 times.
|
694 | if(compatrule_version < 31) |
| 3518 | { | ||
| 3519 | 276 | set_qr(qr_GOHMA_UNDAMAGED_BUG,1); | |
| 3520 | 276 | set_qr(qr_FFCPRELOAD_BUGGED_LOAD,1); | |
| 3521 | 276 | } | |
| 3522 |
2/2✓ Branch 0 taken 418 times.
✓ Branch 1 taken 276 times.
|
694 | if(compatrule_version < 32) |
| 3523 | 276 | set_qr(qr_BROKEN_GETPIXEL_VALUE,1); | |
| 3524 |
2/2✓ Branch 0 taken 418 times.
✓ Branch 1 taken 276 times.
|
694 | if(compatrule_version < 33) |
| 3525 | 276 | set_qr(qr_NO_LIFT_SPRITE,1); | |
| 3526 |
2/2✓ Branch 0 taken 418 times.
✓ Branch 1 taken 276 times.
|
694 | if(compatrule_version < 34) |
| 3527 | { | ||
| 3528 | 276 | set_qr(qr_OLD_SIDEVIEW_LANDING_CODE,1); | |
| 3529 | 276 | set_qr(qr_OLD_FFC_SPEED_CAP,1); | |
| 3530 | 276 | set_qr(qr_OLD_FFC_FUNCTIONALITY,1); | |
| 3531 | 276 | set_qr(qr_OLD_WIZZROBE_SUBMERGING,1); | |
| 3532 | 276 | } | |
| 3533 |
2/2✓ Branch 0 taken 416 times.
✓ Branch 1 taken 278 times.
|
694 | if(compatrule_version < 35) |
| 3534 | { | ||
| 3535 | 278 | set_qr(qr_ZS_NO_NEG_ARRAY,1); | |
| 3536 | 278 | set_qr(qr_BROKEN_INPUT_DOWN_STATE,1); | |
| 3537 | 278 | } | |
| 3538 |
2/2✓ Branch 0 taken 416 times.
✓ Branch 1 taken 278 times.
|
694 | if(compatrule_version < 36) |
| 3539 | 278 | set_qr(qr_OLD_SHALLOW_SFX,1); | |
| 3540 |
2/2✓ Branch 0 taken 412 times.
✓ Branch 1 taken 282 times.
|
694 | if(compatrule_version < 37) |
| 3541 | 282 | set_qr(qr_SPARKLES_INHERIT_PROPERTIES,1); | |
| 3542 |
2/2✓ Branch 0 taken 412 times.
✓ Branch 1 taken 282 times.
|
694 | if(compatrule_version < 38) |
| 3543 | 282 | set_qr(qr_BUGGED_LAYERED_FLAGS,1); | |
| 3544 |
2/2✓ Branch 0 taken 412 times.
✓ Branch 1 taken 282 times.
|
694 | if(compatrule_version < 39) |
| 3545 | 282 | set_qr(qr_HARDCODED_FFC_BUSH_DROPS,1); | |
| 3546 |
2/2✓ Branch 0 taken 412 times.
✓ Branch 1 taken 282 times.
|
694 | if(compatrule_version < 40) |
| 3547 | 282 | set_qr(qr_MOVINGBLOCK_FAKE_SOLID,1); | |
| 3548 |
2/2✓ Branch 0 taken 410 times.
✓ Branch 1 taken 284 times.
|
694 | if(compatrule_version < 41) |
| 3549 | 284 | set_qr(qr_BROKENHITBY,1); | |
| 3550 |
2/2✓ Branch 0 taken 410 times.
✓ Branch 1 taken 284 times.
|
694 | if(compatrule_version < 42) |
| 3551 | 284 | set_qr(qr_BROKEN_MOVING_BOMBS,1); | |
| 3552 |
2/2✓ Branch 0 taken 410 times.
✓ Branch 1 taken 284 times.
|
694 | if(compatrule_version < 43) |
| 3553 | 284 | set_qr(qr_OLD_BOMB_HITBOXES,1); | |
| 3554 |
2/2✓ Branch 0 taken 410 times.
✓ Branch 1 taken 284 times.
|
694 | if(compatrule_version < 44) |
| 3555 | 284 | set_qr(qr_SCROLLWARP_NO_RESET_FRAME,1); | |
| 3556 |
2/2✓ Branch 0 taken 410 times.
✓ Branch 1 taken 284 times.
|
694 | if(compatrule_version < 45) |
| 3557 | 284 | set_qr(qr_ENEMIES_DONT_SCRIPT_FIRST_FRAME,1); | |
| 3558 |
2/2✓ Branch 0 taken 410 times.
✓ Branch 1 taken 284 times.
|
694 | if(compatrule_version < 46) |
| 3559 | 284 | set_qr(qr_BROKEN_RAFT_SCROLL,1); | |
| 3560 |
2/2✓ Branch 0 taken 405 times.
✓ Branch 1 taken 289 times.
|
694 | if(compatrule_version < 47) |
| 3561 | { | ||
| 3562 | 289 | set_qr(qr_SENSITIVE_SOLID_DAMAGE,1); | |
| 3563 | 289 | set_qr(qr_OLD_CONVEYOR_COLLISION,1); | |
| 3564 | 289 | } | |
| 3565 |
2/2✓ Branch 0 taken 405 times.
✓ Branch 1 taken 289 times.
|
694 | if(compatrule_version < 48) |
| 3566 | 289 | set_qr(qr_OLD_GUY_HANDLING,1); | |
| 3567 |
2/2✓ Branch 0 taken 405 times.
✓ Branch 1 taken 289 times.
|
694 | if(compatrule_version < 49) |
| 3568 | 289 | set_qr(qr_FAIRY_FLAG_COMPAT,1); | |
| 3569 |
2/2✓ Branch 0 taken 405 times.
✓ Branch 1 taken 289 times.
|
694 | if(compatrule_version < 50) |
| 3570 | 289 | set_qr(qr_OLD_LENS_LAYEREFFECT,1); | |
| 3571 |
2/2✓ Branch 0 taken 405 times.
✓ Branch 1 taken 289 times.
|
694 | if(compatrule_version < 51) |
| 3572 | 289 | set_qr(qr_PUSHBLOCK_SPRITE_LAYER,1); | |
| 3573 |
2/2✓ Branch 0 taken 405 times.
✓ Branch 1 taken 289 times.
|
694 | if (compatrule_version < 52) |
| 3574 | 289 | set_qr(qr_OLD_SCRIPT_VOLUME, 1); | |
| 3575 |
2/2✓ Branch 0 taken 405 times.
✓ Branch 1 taken 289 times.
|
694 | if(compatrule_version < 53) |
| 3576 | { | ||
| 3577 | 289 | set_qr(qr_OLD_SUBSCR,1); | |
| 3578 | 289 | set_qr(qr_ITM_0_INVIS_ON_BTNS,1); | |
| 3579 | 289 | set_qr(qr_OLD_GAUGE_TILE_LAYOUT,1); | |
| 3580 | 289 | } | |
| 3581 |
2/2✓ Branch 0 taken 405 times.
✓ Branch 1 taken 289 times.
|
694 | if(compatrule_version < 54) |
| 3582 | 289 | set_qr(qr_WALKTHROUGHWALL_NO_DOORSTATE,1); | |
| 3583 |
2/2✓ Branch 0 taken 405 times.
✓ Branch 1 taken 289 times.
|
694 | if(compatrule_version < 55) |
| 3584 | 289 | set_qr(qr_SPOTLIGHT_IGNR_SOLIDOBJ,1); | |
| 3585 |
2/2✓ Branch 0 taken 405 times.
✓ Branch 1 taken 289 times.
|
694 | if(compatrule_version < 56) |
| 3586 | 289 | set_qr(qr_BROKEN_LIGHTBEAM_HITBOX,1); | |
| 3587 |
2/2✓ Branch 0 taken 405 times.
✓ Branch 1 taken 289 times.
|
694 | if(compatrule_version < 57) |
| 3588 | 289 | set_qr(qr_BROKEN_SWORD_SPIN_TRIGGERS,1); | |
| 3589 |
2/2✓ Branch 0 taken 405 times.
✓ Branch 1 taken 289 times.
|
694 | if(compatrule_version < 58) |
| 3590 | 289 | set_qr(qr_OLD_DMAP_INTRO_STRINGS,1); | |
| 3591 |
2/2✓ Branch 0 taken 405 times.
✓ Branch 1 taken 289 times.
|
694 | if(compatrule_version < 59) |
| 3592 | 289 | set_qr(qr_SCRIPT_CONTHP_IS_HEARTS,1); | |
| 3593 |
2/2✓ Branch 0 taken 405 times.
✓ Branch 1 taken 289 times.
|
694 | if(compatrule_version < 60) |
| 3594 | 289 | set_qr(qr_SEPARATE_BOMBABLE_TAPPING_SFX,1); | |
| 3595 |
2/2✓ Branch 0 taken 405 times.
✓ Branch 1 taken 289 times.
|
694 | if(compatrule_version < 61) |
| 3596 | 289 | set_qr(qr_BROKEN_BOMB_AMMO_COSTS,1); | |
| 3597 |
2/2✓ Branch 0 taken 405 times.
✓ Branch 1 taken 289 times.
|
694 | if(compatrule_version < 62) |
| 3598 | 289 | set_qr(qr_OLD_BROKEN_WARPEX_MUSIC,1); | |
| 3599 |
2/2✓ Branch 0 taken 405 times.
✓ Branch 1 taken 289 times.
|
694 | if(compatrule_version < 63) |
| 3600 | { | ||
| 3601 | 289 | set_qr(qr_BROKEN_LIFTSWIM,1); | |
| 3602 | 289 | set_qr(qr_BROKEN_GENERIC_PUSHBLOCK_LOCKING,1); | |
| 3603 | 289 | } | |
| 3604 |
2/2✓ Branch 0 taken 405 times.
✓ Branch 1 taken 289 times.
|
694 | if(compatrule_version < 64) |
| 3605 | 289 | set_qr(qr_BROKEN_FLAME_ARROW_REFLECTING,1); | |
| 3606 |
2/2✓ Branch 0 taken 381 times.
✓ Branch 1 taken 313 times.
|
694 | if(compatrule_version < 65) |
| 3607 | 313 | set_qr(qr_BROKEN_SIDEVIEW_SPRITE_JUMP,1); | |
| 3608 |
2/2✓ Branch 0 taken 105 times.
✓ Branch 1 taken 589 times.
|
694 | if(compatrule_version < 66) |
| 3609 | 589 | set_qr(qr_NEWDARK_TRANS_STACKING,1); | |
| 3610 |
2/2✓ Branch 0 taken 105 times.
✓ Branch 1 taken 589 times.
|
694 | if(compatrule_version < 67) |
| 3611 | 589 | set_qr(qr_OLD_HERO_WARP_RETSQUARE,1); | |
| 3612 | |||
| 3613 | 694 | set_qr(qr_ANIMATECUSTOMWEAPONS,0); | |
| 3614 |
2/2✓ Branch 0 taken 423 times.
✓ Branch 1 taken 271 times.
|
694 | if (s_version < 16) |
| 3615 | 271 | set_qr(qr_BROKEN_HORIZONTAL_WEAPON_ANIM,1); | |
| 3616 | |||
| 3617 | 694 | memcpy(Header, &tempheader, sizeof(tempheader)); | |
| 3618 | |||
| 3619 | 694 | return 0; | |
| 3620 | 694 | } | |
| 3621 | |||
| 3622 | 5822376 | void init_msgstr(MsgStr *str) | |
| 3623 | { | ||
| 3624 | 5822376 | str->s = ""; | |
| 3625 | 5822376 | str->s.shrink_to_fit(); | |
| 3626 | 5822376 | str->nextstring=0; | |
| 3627 | 5822376 | str->tile=0; | |
| 3628 | 5822376 | str->cset=0; | |
| 3629 | 5822376 | str->trans=false; | |
| 3630 | 5822376 | str->font=font_zfont; | |
| 3631 | 5822376 | str->y=32; | |
| 3632 | 5822376 | str->sfx=18; | |
| 3633 | 5822376 | str->listpos=0; | |
| 3634 | 5822376 | str->x=24; | |
| 3635 | 5822376 | str->w=get_qr(qr_STRING_FRAME_OLD_WIDTH_HEIGHT)!=0 ? 24*8 : 26*8; | |
| 3636 | 5822376 | str->h=get_qr(qr_STRING_FRAME_OLD_WIDTH_HEIGHT)!=0 ? 3*8 : 5*8; | |
| 3637 | 5822376 | str->hspace=0; | |
| 3638 | 5822376 | str->vspace=0; | |
| 3639 | 5822376 | str->stringflags=0; | |
| 3640 | 5822376 | str->margins[up] = 8; | |
| 3641 | 5822376 | str->margins[down] = 0; | |
| 3642 | 5822376 | str->margins[left] = 8; | |
| 3643 | 5822376 | str->margins[right] = 8; | |
| 3644 | 5822376 | str->portrait_tile = 0; | |
| 3645 | 5822376 | str->portrait_cset = 0; | |
| 3646 | 5822376 | str->portrait_x = 0; | |
| 3647 | 5822376 | str->portrait_y = 0; | |
| 3648 | 5822376 | str->portrait_tw = 1; | |
| 3649 | 5822376 | str->portrait_th = 1; | |
| 3650 | 5822376 | str->shadow_type = 0; | |
| 3651 | 5822376 | str->shadow_color = 0; | |
| 3652 | 5822376 | str->drawlayer = 6; | |
| 3653 | 5822376 | } | |
| 3654 | |||
| 3655 | 694 | void init_msgstrings(int32_t start, int32_t end) | |
| 3656 | { | ||
| 3657 |
2/4✓ Branch 0 taken 694 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 694 times.
|
694 | if(end <= start || end-start > msg_strings_size) |
| 3658 | ✗ | return; | |
| 3659 | |||
| 3660 |
2/2✓ Branch 0 taken 5685248 times.
✓ Branch 1 taken 694 times.
|
5685942 | for(int32_t i=start; i<end; i++) |
| 3661 | { | ||
| 3662 | 5685248 | init_msgstr(&MsgStrings[i]); | |
| 3663 | 5685248 | MsgStrings[i].listpos=i; | |
| 3664 | 5685248 | } | |
| 3665 | |||
| 3666 |
1/2✓ Branch 0 taken 694 times.
✗ Branch 1 not taken.
|
694 | if(start==0) |
| 3667 | { | ||
| 3668 | 694 | MsgStrings[0].s = "(None)"; | |
| 3669 | 694 | MsgStrings[0].listpos = 0; | |
| 3670 | 694 | } | |
| 3671 | 694 | } | |
| 3672 | |||
| 3673 | 695 | int32_t readstrings(PACKFILE *f, zquestheader *Header) | |
| 3674 | { | ||
| 3675 |
2/2✓ Branch 0 taken 671 times.
✓ Branch 1 taken 24 times.
|
695 | bool should_skip = legacy_skip_flags && get_bit(legacy_skip_flags, skip_strings); |
| 3676 | |||
| 3677 | 695 | MsgStr tempMsgString; | |
| 3678 |
1/2✓ Branch 0 taken 695 times.
✗ Branch 1 not taken.
|
695 | init_msgstr(&tempMsgString); |
| 3679 | |||
| 3680 | 695 | word temp_msg_count=0; | |
| 3681 | word temp_expansion[16]; | ||
| 3682 | 695 | memset(temp_expansion, 0, 16*sizeof(word)); | |
| 3683 | 695 | char buf[8193] = {0}; | |
| 3684 |
2/2✓ Branch 0 taken 24 times.
✓ Branch 1 taken 671 times.
|
695 | if(Header->zelda_version < 0x193) |
| 3685 | { | ||
| 3686 | byte tempbyte; | ||
| 3687 | 24 | int32_t strings_to_read=0; | |
| 3688 |
2/2✓ Branch 0 taken 23 times.
✓ Branch 1 taken 1 times.
|
24 | if (!should_skip) |
| 3689 |
1/2✓ Branch 0 taken 23 times.
✗ Branch 1 not taken.
|
23 | set_qr(qr_OLD_STRING_EDITOR_MARGINS,true); |
| 3690 |
3/4✓ Branch 0 taken 6 times.
✓ Branch 1 taken 18 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 6 times.
|
30 | if((Header->zelda_version < 0x192)|| |
| 3691 |
1/2✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
|
6 | ((Header->zelda_version == 0x192)&&(Header->build<31))) |
| 3692 | { | ||
| 3693 | 18 | strings_to_read=128; | |
| 3694 | 18 | temp_msg_count=Header->old_str_count; | |
| 3695 | |||
| 3696 | // Some sort of string count corruption seems to be common in old quests | ||
| 3697 |
1/2✓ Branch 0 taken 18 times.
✗ Branch 1 not taken.
|
18 | if(temp_msg_count>128) |
| 3698 | { | ||
| 3699 | ✗ | temp_msg_count=128; | |
| 3700 | ✗ | } | |
| 3701 | 18 | } | |
| 3702 |
2/4✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 6 times.
✗ Branch 3 not taken.
|
6 | else if((Header->zelda_version == 0x192)&&(Header->build<140)) |
| 3703 | { | ||
| 3704 | ✗ | strings_to_read=255; | |
| 3705 | ✗ | temp_msg_count=Header->old_str_count; | |
| 3706 | ✗ | } | |
| 3707 | else | ||
| 3708 | { | ||
| 3709 |
2/4✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 6 times.
✗ Branch 3 not taken.
|
6 | if(!p_igetw(&temp_msg_count,f)) |
| 3710 | { | ||
| 3711 | ✗ | return qe_invalid; | |
| 3712 | } | ||
| 3713 | |||
| 3714 | 6 | strings_to_read=temp_msg_count; | |
| 3715 | |||
| 3716 |
3/4✓ Branch 0 taken 5 times.
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 5 times.
|
6 | if (!should_skip && temp_msg_count >= msg_strings_size) |
| 3717 | { | ||
| 3718 | ✗ | Z_message("Reallocating string buffer...\n"); | |
| 3719 | |||
| 3720 | // if((MsgStrings=(MsgStr*)_al_sane_realloc(MsgStrings,sizeof(MsgStr)*MAXMSGS))==NULL) | ||
| 3721 | // return qe_nomem; | ||
| 3722 | |||
| 3723 | //memset(MsgStrings, 0, sizeof(MsgStr)*MAXMSGS); | ||
| 3724 | ✗ | delete[] MsgStrings; | |
| 3725 | ✗ | MsgStrings = new MsgStr[MAXMSGS]; | |
| 3726 | ✗ | msg_strings_size = MAXMSGS; | |
| 3727 | ✗ | for(auto q = 0; q < msg_strings_size; ++q) | |
| 3728 | { | ||
| 3729 | ✗ | MsgStrings[q].clear(); | |
| 3730 | ✗ | } | |
| 3731 | ✗ | } | |
| 3732 | } | ||
| 3733 | |||
| 3734 | //reset the message strings | ||
| 3735 |
2/2✓ Branch 0 taken 23 times.
✓ Branch 1 taken 1 times.
|
24 | if (!should_skip) |
| 3736 |
1/2✓ Branch 0 taken 23 times.
✗ Branch 1 not taken.
|
23 | init_msgstrings(0,msg_strings_size); |
| 3737 | |||
| 3738 |
2/2✓ Branch 0 taken 2550 times.
✓ Branch 1 taken 24 times.
|
2574 | for(int32_t x=0; x<strings_to_read; x++) |
| 3739 | { | ||
| 3740 |
1/2✓ Branch 0 taken 2550 times.
✗ Branch 1 not taken.
|
2550 | init_msgstr(&tempMsgString); |
| 3741 | 2550 | tempMsgString.listpos = x; | |
| 3742 | |||
| 3743 |
2/4✓ Branch 0 taken 2550 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2550 times.
✗ Branch 3 not taken.
|
2550 | if(!pfread(buf,73,f)) |
| 3744 | { | ||
| 3745 | ✗ | return qe_invalid; | |
| 3746 | } | ||
| 3747 | |||
| 3748 | 2550 | buf[74] = '\0'; | |
| 3749 |
1/2✓ Branch 0 taken 2550 times.
✗ Branch 1 not taken.
|
2550 | tempMsgString.s = buf; |
| 3750 | |||
| 3751 |
2/4✓ Branch 0 taken 2550 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2550 times.
✗ Branch 3 not taken.
|
2550 | if(!p_getc(&tempbyte,f)) |
| 3752 | { | ||
| 3753 | ✗ | return qe_invalid; | |
| 3754 | } | ||
| 3755 | |||
| 3756 |
3/4✓ Branch 0 taken 246 times.
✓ Branch 1 taken 2304 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 246 times.
|
2796 | if((Header->zelda_version < 0x192)|| |
| 3757 |
1/2✓ Branch 0 taken 246 times.
✗ Branch 1 not taken.
|
246 | ((Header->zelda_version == 0x192)&&(Header->build<148))) |
| 3758 | { | ||
| 3759 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2304 times.
|
2304 | tempMsgString.nextstring=tempbyte?x+1:0; |
| 3760 | |||
| 3761 |
2/4✓ Branch 0 taken 2304 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2304 times.
✗ Branch 3 not taken.
|
2304 | if(!p_getc(&tempbyte,f)) |
| 3762 | { | ||
| 3763 | ✗ | return qe_invalid; | |
| 3764 | } | ||
| 3765 | |||
| 3766 |
2/4✓ Branch 0 taken 2304 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2304 times.
✗ Branch 3 not taken.
|
2304 | if(!p_getc(&tempbyte,f)) |
| 3767 | { | ||
| 3768 | ✗ | return qe_invalid; | |
| 3769 | } | ||
| 3770 | 2304 | } | |
| 3771 | else | ||
| 3772 | { | ||
| 3773 |
2/4✓ Branch 0 taken 246 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 246 times.
✗ Branch 3 not taken.
|
246 | if(!p_igetw(&tempMsgString.nextstring,f)) |
| 3774 | { | ||
| 3775 | ✗ | return qe_invalid; | |
| 3776 | } | ||
| 3777 | |||
| 3778 |
2/4✓ Branch 0 taken 246 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 246 times.
✗ Branch 3 not taken.
|
246 | if(!pfread(temp_expansion,32,f)) |
| 3779 | { | ||
| 3780 | ✗ | return qe_invalid; | |
| 3781 | } | ||
| 3782 | } | ||
| 3783 | |||
| 3784 |
2/2✓ Branch 0 taken 2549 times.
✓ Branch 1 taken 1 times.
|
2550 | if (!should_skip) |
| 3785 |
1/2✓ Branch 0 taken 2549 times.
✗ Branch 1 not taken.
|
2549 | MsgStrings[x] = tempMsgString; |
| 3786 | 2550 | } | |
| 3787 | 24 | } | |
| 3788 | else | ||
| 3789 | { | ||
| 3790 | int32_t dummy_int; | ||
| 3791 | word s_version; | ||
| 3792 | word s_cversion; | ||
| 3793 | |||
| 3794 | //section version info | ||
| 3795 |
2/4✓ Branch 0 taken 671 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 671 times.
✗ Branch 3 not taken.
|
671 | if(!p_igetw(&s_version,f)) |
| 3796 | { | ||
| 3797 | ✗ | return qe_invalid; | |
| 3798 | } | ||
| 3799 | |||
| 3800 | 671 | FFCore.quest_format[vStrings] = s_version; | |
| 3801 | |||
| 3802 |
2/4✓ Branch 0 taken 671 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 671 times.
✗ Branch 3 not taken.
|
671 | if(!p_igetw(&s_cversion,f)) |
| 3803 | { | ||
| 3804 | ✗ | return qe_invalid; | |
| 3805 | } | ||
| 3806 | |||
| 3807 | //al_trace("Strings version %d\n", s_version); | ||
| 3808 | //section size | ||
| 3809 |
2/4✓ Branch 0 taken 671 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 671 times.
✗ Branch 3 not taken.
|
671 | if(!p_igetl(&dummy_int,f)) |
| 3810 | { | ||
| 3811 | ✗ | return qe_invalid; | |
| 3812 | } | ||
| 3813 | |||
| 3814 | //finally... section data | ||
| 3815 |
2/4✓ Branch 0 taken 671 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 671 times.
✗ Branch 3 not taken.
|
671 | if(!p_igetw(&temp_msg_count,f)) |
| 3816 | { | ||
| 3817 | ✗ | return qe_invalid; | |
| 3818 | } | ||
| 3819 | |||
| 3820 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 671 times.
|
671 | if(temp_msg_count >= msg_strings_size) |
| 3821 | { | ||
| 3822 | ✗ | Z_message("Reallocating string buffer...\n"); | |
| 3823 | |||
| 3824 | // if((MsgStrings=(MsgStr*)_al_sane_realloc(MsgStrings,sizeof(MsgStr)*MAXMSGS))==NULL) | ||
| 3825 | // return qe_nomem; | ||
| 3826 | ✗ | delete[] MsgStrings; | |
| 3827 | ✗ | MsgStrings = new MsgStr[MAXMSGS]; | |
| 3828 | ✗ | msg_strings_size = MAXMSGS; | |
| 3829 | ✗ | for(auto q = 0; q < msg_strings_size; ++q) | |
| 3830 | { | ||
| 3831 | ✗ | MsgStrings[q].clear(); | |
| 3832 | ✗ | } | |
| 3833 | //memset(MsgStrings, 0, sizeof(MsgStr)*MAXMSGS); | ||
| 3834 | ✗ | } | |
| 3835 | |||
| 3836 | //reset the message strings | ||
| 3837 |
2/2✓ Branch 0 taken 248 times.
✓ Branch 1 taken 423 times.
|
671 | if(s_version < 7) |
| 3838 |
1/2✓ Branch 0 taken 248 times.
✗ Branch 1 not taken.
|
248 | set_qr(qr_OLD_STRING_EDITOR_MARGINS,true); |
| 3839 |
1/2✓ Branch 0 taken 671 times.
✗ Branch 1 not taken.
|
671 | init_msgstrings(0,msg_strings_size); |
| 3840 | |||
| 3841 | 671 | int32_t string_length=(s_version<2)?73:145; | |
| 3842 | |||
| 3843 |
2/2✓ Branch 0 taken 133883 times.
✓ Branch 1 taken 671 times.
|
134554 | for(int32_t i=0; i<temp_msg_count; i++) |
| 3844 | { | ||
| 3845 |
1/2✓ Branch 0 taken 133883 times.
✗ Branch 1 not taken.
|
133883 | init_msgstr(&tempMsgString); |
| 3846 | 133883 | tempMsgString.listpos = i; | |
| 3847 |
2/2✓ Branch 0 taken 5689 times.
✓ Branch 1 taken 128194 times.
|
133883 | if(s_version > 8) |
| 3848 | { | ||
| 3849 |
2/4✓ Branch 0 taken 5689 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 5689 times.
✗ Branch 3 not taken.
|
5689 | if(!p_igetl(&string_length,f)) |
| 3850 | { | ||
| 3851 | ✗ | return qe_invalid; | |
| 3852 | } | ||
| 3853 | 5689 | } | |
| 3854 | |||
| 3855 |
2/4✓ Branch 0 taken 133883 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 133883 times.
|
133883 | if (string_length < 0 || string_length > 8193) |
| 3856 | { | ||
| 3857 | ✗ | return qe_invalid; | |
| 3858 | } | ||
| 3859 | |||
| 3860 |
2/2✓ Branch 0 taken 133361 times.
✓ Branch 1 taken 522 times.
|
133883 | if (string_length > 0) |
| 3861 | { | ||
| 3862 |
2/4✓ Branch 0 taken 133361 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 133361 times.
✗ Branch 3 not taken.
|
133361 | if (!pfread(buf, string_length, f)) |
| 3863 | { | ||
| 3864 | ✗ | return qe_invalid; | |
| 3865 | } | ||
| 3866 | 133361 | } | |
| 3867 | else | ||
| 3868 | { | ||
| 3869 | 522 | buf[0] = 0; | |
| 3870 | } | ||
| 3871 | |||
| 3872 |
2/4✓ Branch 0 taken 133883 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 133883 times.
✗ Branch 3 not taken.
|
133883 | if(!p_igetw(&tempMsgString.nextstring,f)) |
| 3873 | { | ||
| 3874 | ✗ | return qe_invalid; | |
| 3875 | } | ||
| 3876 | |||
| 3877 |
2/2✓ Branch 0 taken 33613 times.
✓ Branch 1 taken 100270 times.
|
133883 | if(s_version<2) |
| 3878 | { | ||
| 3879 | 33613 | buf[72] = '\0'; | |
| 3880 |
1/2✓ Branch 0 taken 33613 times.
✗ Branch 1 not taken.
|
33613 | tempMsgString.s = buf; |
| 3881 | 33613 | } | |
| 3882 | else | ||
| 3883 | { | ||
| 3884 | // June 2008: A bug corrupted the last 4 chars of a string. | ||
| 3885 | // Discard these. | ||
| 3886 |
1/2✓ Branch 0 taken 100270 times.
✗ Branch 1 not taken.
|
100270 | if(s_version<3) |
| 3887 | { | ||
| 3888 | ✗ | for(int32_t j=140; j<144; j++) | |
| 3889 | { | ||
| 3890 | ✗ | buf[j] = '\0'; | |
| 3891 | ✗ | } | |
| 3892 | ✗ | } | |
| 3893 |
1/2✓ Branch 0 taken 100270 times.
✗ Branch 1 not taken.
|
100270 | if(string_length > 8192) string_length = 8192; |
| 3894 | 100270 | buf[string_length]='\0'; //Force-terminate | |
| 3895 |
1/2✓ Branch 0 taken 100270 times.
✗ Branch 1 not taken.
|
100270 | tempMsgString.s = buf; |
| 3896 | |||
| 3897 |
2/2✓ Branch 0 taken 5689 times.
✓ Branch 1 taken 94581 times.
|
100270 | if ( s_version >= 6 ) |
| 3898 | { | ||
| 3899 |
2/4✓ Branch 0 taken 5689 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 5689 times.
✗ Branch 3 not taken.
|
5689 | if(!p_igetl(&tempMsgString.tile,f)) |
| 3900 | { | ||
| 3901 | ✗ | return qe_invalid; | |
| 3902 | } | ||
| 3903 | 5689 | } | |
| 3904 | else | ||
| 3905 | { | ||
| 3906 |
2/4✓ Branch 0 taken 94581 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 94581 times.
✗ Branch 3 not taken.
|
94581 | if(!p_igetw(&tempMsgString.tile,f)) |
| 3907 | { | ||
| 3908 | ✗ | return qe_invalid; | |
| 3909 | } | ||
| 3910 | } | ||
| 3911 | |||
| 3912 |
2/4✓ Branch 0 taken 100270 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 100270 times.
✗ Branch 3 not taken.
|
100270 | if(!p_getc(&tempMsgString.cset,f)) |
| 3913 | { | ||
| 3914 | ✗ | return qe_invalid; | |
| 3915 | } | ||
| 3916 | |||
| 3917 | byte dummy_char; | ||
| 3918 | |||
| 3919 |
2/4✓ Branch 0 taken 100270 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 100270 times.
✗ Branch 3 not taken.
|
100270 | if(!p_getc(&dummy_char,f)) // trans is stored as a char... |
| 3920 | { | ||
| 3921 | ✗ | return qe_invalid; | |
| 3922 | } | ||
| 3923 | |||
| 3924 | 100270 | tempMsgString.trans=dummy_char!=0; | |
| 3925 | |||
| 3926 |
2/4✓ Branch 0 taken 100270 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 100270 times.
✗ Branch 3 not taken.
|
100270 | if(!p_getc(&tempMsgString.font,f)) |
| 3927 | { | ||
| 3928 | ✗ | return qe_invalid; | |
| 3929 | } | ||
| 3930 | |||
| 3931 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 100270 times.
|
100270 | if(s_version < 5) |
| 3932 | { | ||
| 3933 | ✗ | if(!p_getc(&tempMsgString.y,f)) | |
| 3934 | { | ||
| 3935 | ✗ | return qe_invalid; | |
| 3936 | } | ||
| 3937 | ✗ | } | |
| 3938 | else | ||
| 3939 | { | ||
| 3940 |
2/4✓ Branch 0 taken 100270 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 100270 times.
✗ Branch 3 not taken.
|
100270 | if(!p_igetw(&tempMsgString.x,f)) |
| 3941 | { | ||
| 3942 | ✗ | return qe_invalid; | |
| 3943 | } | ||
| 3944 | |||
| 3945 |
2/4✓ Branch 0 taken 100270 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 100270 times.
✗ Branch 3 not taken.
|
100270 | if(!p_igetw(&tempMsgString.y,f)) |
| 3946 | { | ||
| 3947 | ✗ | return qe_invalid; | |
| 3948 | } | ||
| 3949 | |||
| 3950 |
2/4✓ Branch 0 taken 100270 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 100270 times.
✗ Branch 3 not taken.
|
100270 | if(!p_igetw(&tempMsgString.w,f)) |
| 3951 | { | ||
| 3952 | ✗ | return qe_invalid; | |
| 3953 | } | ||
| 3954 | |||
| 3955 |
2/4✓ Branch 0 taken 100270 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 100270 times.
✗ Branch 3 not taken.
|
100270 | if(!p_igetw(&tempMsgString.h,f)) |
| 3956 | { | ||
| 3957 | ✗ | return qe_invalid; | |
| 3958 | } | ||
| 3959 | |||
| 3960 |
2/4✓ Branch 0 taken 100270 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 100270 times.
✗ Branch 3 not taken.
|
100270 | if(!p_getc(&tempMsgString.hspace,f)) |
| 3961 | { | ||
| 3962 | ✗ | return qe_invalid; | |
| 3963 | } | ||
| 3964 | |||
| 3965 |
2/4✓ Branch 0 taken 100270 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 100270 times.
✗ Branch 3 not taken.
|
100270 | if(!p_getc(&tempMsgString.vspace,f)) |
| 3966 | { | ||
| 3967 | ✗ | return qe_invalid; | |
| 3968 | } | ||
| 3969 | |||
| 3970 |
2/4✓ Branch 0 taken 100270 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 100270 times.
✗ Branch 3 not taken.
|
100270 | if(!p_getc(&tempMsgString.stringflags,f)) |
| 3971 | { | ||
| 3972 | ✗ | return qe_invalid; | |
| 3973 | } | ||
| 3974 | } | ||
| 3975 | |||
| 3976 |
2/2✓ Branch 0 taken 94581 times.
✓ Branch 1 taken 5689 times.
|
100270 | if(s_version >= 7) |
| 3977 | { | ||
| 3978 |
2/2✓ Branch 0 taken 5689 times.
✓ Branch 1 taken 22756 times.
|
28445 | for(int32_t q = 0; q < 4; ++q) |
| 3979 | { | ||
| 3980 |
2/4✓ Branch 0 taken 22756 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 22756 times.
✗ Branch 3 not taken.
|
22756 | if(!p_getc(&tempMsgString.margins[q],f)) |
| 3981 | { | ||
| 3982 | ✗ | return qe_invalid; | |
| 3983 | } | ||
| 3984 | 22756 | } | |
| 3985 | |||
| 3986 |
2/4✓ Branch 0 taken 5689 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 5689 times.
✗ Branch 3 not taken.
|
5689 | if(!p_igetl(&tempMsgString.portrait_tile,f)) |
| 3987 | { | ||
| 3988 | ✗ | return qe_invalid; | |
| 3989 | } | ||
| 3990 | |||
| 3991 |
2/4✓ Branch 0 taken 5689 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 5689 times.
✗ Branch 3 not taken.
|
5689 | if(!p_getc(&tempMsgString.portrait_cset,f)) |
| 3992 | { | ||
| 3993 | ✗ | return qe_invalid; | |
| 3994 | } | ||
| 3995 | |||
| 3996 |
2/4✓ Branch 0 taken 5689 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 5689 times.
✗ Branch 3 not taken.
|
5689 | if(!p_getc(&tempMsgString.portrait_x,f)) |
| 3997 | { | ||
| 3998 | ✗ | return qe_invalid; | |
| 3999 | } | ||
| 4000 | |||
| 4001 |
2/4✓ Branch 0 taken 5689 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 5689 times.
✗ Branch 3 not taken.
|
5689 | if(!p_getc(&tempMsgString.portrait_y,f)) |
| 4002 | { | ||
| 4003 | ✗ | return qe_invalid; | |
| 4004 | } | ||
| 4005 | |||
| 4006 |
2/4✓ Branch 0 taken 5689 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 5689 times.
✗ Branch 3 not taken.
|
5689 | if(!p_getc(&tempMsgString.portrait_tw,f)) |
| 4007 | { | ||
| 4008 | ✗ | return qe_invalid; | |
| 4009 | } | ||
| 4010 | |||
| 4011 |
2/4✓ Branch 0 taken 5689 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 5689 times.
✗ Branch 3 not taken.
|
5689 | if(!p_getc(&tempMsgString.portrait_th,f)) |
| 4012 | { | ||
| 4013 | ✗ | return qe_invalid; | |
| 4014 | } | ||
| 4015 | 5689 | } | |
| 4016 | |||
| 4017 |
2/2✓ Branch 0 taken 5689 times.
✓ Branch 1 taken 94581 times.
|
100270 | if(s_version >= 8) |
| 4018 | { | ||
| 4019 |
2/4✓ Branch 0 taken 5689 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 5689 times.
✗ Branch 3 not taken.
|
5689 | if(!p_getc(&tempMsgString.shadow_type,f)) |
| 4020 | { | ||
| 4021 | ✗ | return qe_invalid; | |
| 4022 | } | ||
| 4023 | |||
| 4024 |
2/4✓ Branch 0 taken 5689 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 5689 times.
✗ Branch 3 not taken.
|
5689 | if(!p_getc(&tempMsgString.shadow_color,f)) |
| 4025 | { | ||
| 4026 | ✗ | return qe_invalid; | |
| 4027 | } | ||
| 4028 | 5689 | } | |
| 4029 | |||
| 4030 |
2/2✓ Branch 0 taken 5380 times.
✓ Branch 1 taken 94890 times.
|
100270 | if(s_version >= 10) |
| 4031 | { | ||
| 4032 |
2/4✓ Branch 0 taken 5380 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 5380 times.
✗ Branch 3 not taken.
|
5380 | if(!p_getc(&tempMsgString.drawlayer,f)) |
| 4033 | { | ||
| 4034 | ✗ | return qe_invalid; | |
| 4035 | } | ||
| 4036 | 5380 | } | |
| 4037 | |||
| 4038 |
2/4✓ Branch 0 taken 100270 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 100270 times.
✗ Branch 3 not taken.
|
100270 | if(!p_getc(&tempMsgString.sfx,f)) |
| 4039 | { | ||
| 4040 | ✗ | return qe_invalid; | |
| 4041 | } | ||
| 4042 | |||
| 4043 |
1/2✓ Branch 0 taken 100270 times.
✗ Branch 1 not taken.
|
100270 | if(s_version>3) |
| 4044 | { | ||
| 4045 |
2/4✓ Branch 0 taken 100270 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 100270 times.
✗ Branch 3 not taken.
|
100270 | if(!p_igetw(&tempMsgString.listpos,f)) |
| 4046 | { | ||
| 4047 | ✗ | return qe_invalid; | |
| 4048 | } | ||
| 4049 | 100270 | } | |
| 4050 | } | ||
| 4051 | |||
| 4052 |
1/2✓ Branch 0 taken 133883 times.
✗ Branch 1 not taken.
|
133883 | MsgStrings[i].copyAll(tempMsgString); |
| 4053 | 133883 | } | |
| 4054 | } | ||
| 4055 | |||
| 4056 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 694 times.
|
695 | if (!should_skip) |
| 4057 | 694 | msg_count=temp_msg_count; | |
| 4058 | |||
| 4059 | 695 | return 0; | |
| 4060 | 695 | } | |
| 4061 | |||
| 4062 | 695 | int32_t readdoorcombosets(PACKFILE *f, zquestheader *Header) | |
| 4063 | { | ||
| 4064 |
2/2✓ Branch 0 taken 671 times.
✓ Branch 1 taken 24 times.
|
695 | bool should_skip = legacy_skip_flags && get_bit(legacy_skip_flags, skip_doors); |
| 4065 | |||
| 4066 |
3/4✓ Branch 0 taken 677 times.
✓ Branch 1 taken 18 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 6 times.
|
701 | if((Header->zelda_version < 0x192)|| |
| 4067 |
2/2✓ Branch 0 taken 6 times.
✓ Branch 1 taken 671 times.
|
677 | ((Header->zelda_version == 0x192)&&(Header->build<158))) |
| 4068 | { | ||
| 4069 | 18 | return 0; | |
| 4070 | } | ||
| 4071 | |||
| 4072 | 677 | word temp_door_combo_set_count=0; | |
| 4073 | DoorComboSet tempDoorComboSet; | ||
| 4074 | word dummy_word; | ||
| 4075 | int32_t dummy_long; | ||
| 4076 | byte padding; | ||
| 4077 | 677 | int32_t s_version = 0; | |
| 4078 | |||
| 4079 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 676 times.
|
677 | if (!should_skip) |
| 4080 |
2/2✓ Branch 0 taken 173056 times.
✓ Branch 1 taken 676 times.
|
173732 | for(int32_t i=0; i<MAXDOORCOMBOSETS; i++) |
| 4081 | { | ||
| 4082 | 173056 | memset(DoorComboSets+i, 0, sizeof(DoorComboSet)); | |
| 4083 | 173732 | } | |
| 4084 | |||
| 4085 |
2/2✓ Branch 0 taken 6 times.
✓ Branch 1 taken 671 times.
|
677 | if(Header->zelda_version > 0x192) |
| 4086 | { | ||
| 4087 | //section version info | ||
| 4088 |
1/2✓ Branch 0 taken 671 times.
✗ Branch 1 not taken.
|
671 | if(!p_igetw(&s_version,f)) |
| 4089 | { | ||
| 4090 | ✗ | return qe_invalid; | |
| 4091 | } | ||
| 4092 | |||
| 4093 | 671 | FFCore.quest_format[vDoors] = s_version; | |
| 4094 | |||
| 4095 | //al_trace("Door combo sets version %d\n", dummy_word); | ||
| 4096 |
1/2✓ Branch 0 taken 671 times.
✗ Branch 1 not taken.
|
671 | if(!p_igetw(&dummy_word,f)) |
| 4097 | { | ||
| 4098 | ✗ | return qe_invalid; | |
| 4099 | } | ||
| 4100 | |||
| 4101 | //section size | ||
| 4102 |
1/2✓ Branch 0 taken 671 times.
✗ Branch 1 not taken.
|
671 | if(!p_igetl(&dummy_long,f)) |
| 4103 | { | ||
| 4104 | ✗ | return qe_invalid; | |
| 4105 | } | ||
| 4106 | 671 | } | |
| 4107 | |||
| 4108 | //finally... section data | ||
| 4109 |
1/2✓ Branch 0 taken 677 times.
✗ Branch 1 not taken.
|
677 | if(!p_igetw(&temp_door_combo_set_count,f)) |
| 4110 | { | ||
| 4111 | ✗ | return qe_invalid; | |
| 4112 | } | ||
| 4113 | |||
| 4114 |
2/4✓ Branch 0 taken 677 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 677 times.
|
677 | if (!(temp_door_combo_set_count >= 0 && temp_door_combo_set_count <= MAXDOORCOMBOSETS)) |
| 4115 | { | ||
| 4116 | ✗ | return qe_invalid; | |
| 4117 | } | ||
| 4118 | |||
| 4119 |
2/2✓ Branch 0 taken 5657 times.
✓ Branch 1 taken 677 times.
|
6334 | for(int32_t i=0; i<temp_door_combo_set_count; i++) |
| 4120 | { | ||
| 4121 | 5657 | memset(&tempDoorComboSet, 0, sizeof(DoorComboSet)); | |
| 4122 | |||
| 4123 | //name | ||
| 4124 |
1/2✓ Branch 0 taken 5657 times.
✗ Branch 1 not taken.
|
5657 | if(!pfread(&tempDoorComboSet.name,sizeof(tempDoorComboSet.name),f)) |
| 4125 | { | ||
| 4126 | ✗ | return qe_invalid; | |
| 4127 | } | ||
| 4128 | |||
| 4129 |
2/2✓ Branch 0 taken 5617 times.
✓ Branch 1 taken 40 times.
|
5657 | if(Header->zelda_version < 0x193) |
| 4130 | { | ||
| 4131 |
1/2✓ Branch 0 taken 40 times.
✗ Branch 1 not taken.
|
40 | if(!p_getc(&padding,f)) |
| 4132 | { | ||
| 4133 | ✗ | return qe_invalid; | |
| 4134 | } | ||
| 4135 | 40 | } | |
| 4136 | |||
| 4137 | //up door | ||
| 4138 |
2/2✓ Branch 0 taken 50913 times.
✓ Branch 1 taken 5657 times.
|
56570 | for(int32_t j=0; j<9; j++) |
| 4139 | { | ||
| 4140 |
2/2✓ Branch 0 taken 203652 times.
✓ Branch 1 taken 50913 times.
|
254565 | for(int32_t k=0; k<4; k++) |
| 4141 | { | ||
| 4142 |
1/2✓ Branch 0 taken 203652 times.
✗ Branch 1 not taken.
|
203652 | if(!p_igetw(&tempDoorComboSet.doorcombo_u[j][k],f)) |
| 4143 | { | ||
| 4144 | ✗ | return qe_invalid; | |
| 4145 | } | ||
| 4146 | 203652 | } | |
| 4147 | 50913 | } | |
| 4148 | |||
| 4149 |
2/2✓ Branch 0 taken 50913 times.
✓ Branch 1 taken 5657 times.
|
56570 | for(int32_t j=0; j<9; j++) |
| 4150 | { | ||
| 4151 |
2/2✓ Branch 0 taken 203652 times.
✓ Branch 1 taken 50913 times.
|
254565 | for(int32_t k=0; k<4; k++) |
| 4152 | { | ||
| 4153 |
1/2✓ Branch 0 taken 203652 times.
✗ Branch 1 not taken.
|
203652 | if(!p_getc(&tempDoorComboSet.doorcset_u[j][k],f)) |
| 4154 | { | ||
| 4155 | ✗ | return qe_invalid; | |
| 4156 | } | ||
| 4157 | 203652 | } | |
| 4158 | 50913 | } | |
| 4159 | |||
| 4160 | //down door | ||
| 4161 |
2/2✓ Branch 0 taken 50913 times.
✓ Branch 1 taken 5657 times.
|
56570 | for(int32_t j=0; j<9; j++) |
| 4162 | { | ||
| 4163 |
2/2✓ Branch 0 taken 203652 times.
✓ Branch 1 taken 50913 times.
|
254565 | for(int32_t k=0; k<4; k++) |
| 4164 | { | ||
| 4165 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 203652 times.
|
203652 | if(!p_igetw(&tempDoorComboSet.doorcombo_d[j][k],f)) |
| 4166 | { | ||
| 4167 | ✗ | return qe_invalid; | |
| 4168 | } | ||
| 4169 | 203652 | } | |
| 4170 | 50913 | } | |
| 4171 | |||
| 4172 |
2/2✓ Branch 0 taken 50913 times.
✓ Branch 1 taken 5657 times.
|
56570 | for(int32_t j=0; j<9; j++) |
| 4173 | { | ||
| 4174 |
2/2✓ Branch 0 taken 203652 times.
✓ Branch 1 taken 50913 times.
|
254565 | for(int32_t k=0; k<4; k++) |
| 4175 | { | ||
| 4176 |
1/2✓ Branch 0 taken 203652 times.
✗ Branch 1 not taken.
|
203652 | if(!p_getc(&tempDoorComboSet.doorcset_d[j][k],f)) |
| 4177 | { | ||
| 4178 | ✗ | return qe_invalid; | |
| 4179 | } | ||
| 4180 | 203652 | } | |
| 4181 | 50913 | } | |
| 4182 | |||
| 4183 | //left door | ||
| 4184 |
2/2✓ Branch 0 taken 50913 times.
✓ Branch 1 taken 5657 times.
|
56570 | for(int32_t j=0; j<9; j++) |
| 4185 | { | ||
| 4186 |
2/2✓ Branch 0 taken 305478 times.
✓ Branch 1 taken 50913 times.
|
356391 | for(int32_t k=0; k<6; k++) |
| 4187 | { | ||
| 4188 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 305478 times.
|
305478 | if(!p_igetw(&tempDoorComboSet.doorcombo_l[j][k],f)) |
| 4189 | { | ||
| 4190 | ✗ | return qe_invalid; | |
| 4191 | } | ||
| 4192 | 305478 | } | |
| 4193 | 50913 | } | |
| 4194 | |||
| 4195 |
2/2✓ Branch 0 taken 50913 times.
✓ Branch 1 taken 5657 times.
|
56570 | for(int32_t j=0; j<9; j++) |
| 4196 | { | ||
| 4197 |
2/2✓ Branch 0 taken 305478 times.
✓ Branch 1 taken 50913 times.
|
356391 | for(int32_t k=0; k<6; k++) |
| 4198 | { | ||
| 4199 |
1/2✓ Branch 0 taken 305478 times.
✗ Branch 1 not taken.
|
305478 | if(!p_getc(&tempDoorComboSet.doorcset_l[j][k],f)) |
| 4200 | { | ||
| 4201 | ✗ | return qe_invalid; | |
| 4202 | } | ||
| 4203 | 305478 | } | |
| 4204 | 50913 | } | |
| 4205 | |||
| 4206 | //right door | ||
| 4207 |
2/2✓ Branch 0 taken 50913 times.
✓ Branch 1 taken 5657 times.
|
56570 | for(int32_t j=0; j<9; j++) |
| 4208 | { | ||
| 4209 |
2/2✓ Branch 0 taken 305478 times.
✓ Branch 1 taken 50913 times.
|
356391 | for(int32_t k=0; k<6; k++) |
| 4210 | { | ||
| 4211 |
1/2✓ Branch 0 taken 305478 times.
✗ Branch 1 not taken.
|
305478 | if(!p_igetw(&tempDoorComboSet.doorcombo_r[j][k],f)) |
| 4212 | { | ||
| 4213 | ✗ | return qe_invalid; | |
| 4214 | } | ||
| 4215 | 305478 | } | |
| 4216 | 50913 | } | |
| 4217 | |||
| 4218 |
2/2✓ Branch 0 taken 50913 times.
✓ Branch 1 taken 5657 times.
|
56570 | for(int32_t j=0; j<9; j++) |
| 4219 | { | ||
| 4220 |
2/2✓ Branch 0 taken 305478 times.
✓ Branch 1 taken 50913 times.
|
356391 | for(int32_t k=0; k<6; k++) |
| 4221 | { | ||
| 4222 |
1/2✓ Branch 0 taken 305478 times.
✗ Branch 1 not taken.
|
305478 | if(!p_getc(&tempDoorComboSet.doorcset_r[j][k],f)) |
| 4223 | { | ||
| 4224 | ✗ | return qe_invalid; | |
| 4225 | } | ||
| 4226 | 305478 | } | |
| 4227 | 50913 | } | |
| 4228 | |||
| 4229 | //up bomb rubble | ||
| 4230 |
2/2✓ Branch 0 taken 11314 times.
✓ Branch 1 taken 5657 times.
|
16971 | for(int32_t j=0; j<2; j++) |
| 4231 | { | ||
| 4232 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 11314 times.
|
11314 | if(!p_igetw(&tempDoorComboSet.bombdoorcombo_u[j],f)) |
| 4233 | { | ||
| 4234 | ✗ | return qe_invalid; | |
| 4235 | } | ||
| 4236 | 11314 | } | |
| 4237 | |||
| 4238 |
2/2✓ Branch 0 taken 11314 times.
✓ Branch 1 taken 5657 times.
|
16971 | for(int32_t j=0; j<2; j++) |
| 4239 | { | ||
| 4240 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 11314 times.
|
11314 | if(!p_getc(&tempDoorComboSet.bombdoorcset_u[j],f)) |
| 4241 | { | ||
| 4242 | ✗ | return qe_invalid; | |
| 4243 | } | ||
| 4244 | 11314 | } | |
| 4245 | |||
| 4246 | //down bomb rubble | ||
| 4247 |
2/2✓ Branch 0 taken 11314 times.
✓ Branch 1 taken 5657 times.
|
16971 | for(int32_t j=0; j<2; j++) |
| 4248 | { | ||
| 4249 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 11314 times.
|
11314 | if(!p_igetw(&tempDoorComboSet.bombdoorcombo_d[j],f)) |
| 4250 | { | ||
| 4251 | ✗ | return qe_invalid; | |
| 4252 | } | ||
| 4253 | 11314 | } | |
| 4254 | |||
| 4255 |
2/2✓ Branch 0 taken 11314 times.
✓ Branch 1 taken 5657 times.
|
16971 | for(int32_t j=0; j<2; j++) |
| 4256 | { | ||
| 4257 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 11314 times.
|
11314 | if(!p_getc(&tempDoorComboSet.bombdoorcset_d[j],f)) |
| 4258 | { | ||
| 4259 | ✗ | return qe_invalid; | |
| 4260 | } | ||
| 4261 | 11314 | } | |
| 4262 | |||
| 4263 | //left bomb rubble | ||
| 4264 |
2/2✓ Branch 0 taken 16971 times.
✓ Branch 1 taken 5657 times.
|
22628 | for(int32_t j=0; j<3; j++) |
| 4265 | { | ||
| 4266 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 16971 times.
|
16971 | if(!p_igetw(&tempDoorComboSet.bombdoorcombo_l[j],f)) |
| 4267 | { | ||
| 4268 | ✗ | return qe_invalid; | |
| 4269 | } | ||
| 4270 | 16971 | } | |
| 4271 | |||
| 4272 |
2/2✓ Branch 0 taken 16971 times.
✓ Branch 1 taken 5657 times.
|
22628 | for(int32_t j=0; j<3; j++) |
| 4273 | { | ||
| 4274 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 16971 times.
|
16971 | if(!p_getc(&tempDoorComboSet.bombdoorcset_l[j],f)) |
| 4275 | { | ||
| 4276 | ✗ | return qe_invalid; | |
| 4277 | } | ||
| 4278 | 16971 | } | |
| 4279 | |||
| 4280 |
2/2✓ Branch 0 taken 5617 times.
✓ Branch 1 taken 40 times.
|
5657 | if(Header->zelda_version < 0x193) |
| 4281 | { | ||
| 4282 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 40 times.
|
40 | if(!p_getc(&padding,f)) |
| 4283 | { | ||
| 4284 | ✗ | return qe_invalid; | |
| 4285 | } | ||
| 4286 | |||
| 4287 | 40 | } | |
| 4288 | |||
| 4289 | //right bomb rubble | ||
| 4290 |
2/2✓ Branch 0 taken 16971 times.
✓ Branch 1 taken 5657 times.
|
22628 | for(int32_t j=0; j<3; j++) |
| 4291 | { | ||
| 4292 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 16971 times.
|
16971 | if(!p_igetw(&tempDoorComboSet.bombdoorcombo_r[j],f)) |
| 4293 | { | ||
| 4294 | ✗ | return qe_invalid; | |
| 4295 | } | ||
| 4296 | 16971 | } | |
| 4297 | |||
| 4298 |
2/2✓ Branch 0 taken 16971 times.
✓ Branch 1 taken 5657 times.
|
22628 | for(int32_t j=0; j<3; j++) |
| 4299 | { | ||
| 4300 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 16971 times.
|
16971 | if(!p_getc(&tempDoorComboSet.bombdoorcset_r[j],f)) |
| 4301 | { | ||
| 4302 | ✗ | return qe_invalid; | |
| 4303 | } | ||
| 4304 | 16971 | } | |
| 4305 | |||
| 4306 |
2/2✓ Branch 0 taken 5617 times.
✓ Branch 1 taken 40 times.
|
5657 | if(Header->zelda_version < 0x193) |
| 4307 | { | ||
| 4308 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 40 times.
|
40 | if(!p_getc(&padding,f)) |
| 4309 | { | ||
| 4310 | ✗ | return qe_invalid; | |
| 4311 | } | ||
| 4312 | 40 | } | |
| 4313 | |||
| 4314 | //walkthrough stuff | ||
| 4315 |
2/2✓ Branch 0 taken 22628 times.
✓ Branch 1 taken 5657 times.
|
28285 | for(int32_t j=0; j<4; j++) |
| 4316 | { | ||
| 4317 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 22628 times.
|
22628 | if(!p_igetw(&tempDoorComboSet.walkthroughcombo[j],f)) |
| 4318 | { | ||
| 4319 | ✗ | return qe_invalid; | |
| 4320 | } | ||
| 4321 | 22628 | } | |
| 4322 | |||
| 4323 |
2/2✓ Branch 0 taken 22628 times.
✓ Branch 1 taken 5657 times.
|
28285 | for(int32_t j=0; j<4; j++) |
| 4324 | { | ||
| 4325 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 22628 times.
|
22628 | if(!p_getc(&tempDoorComboSet.walkthroughcset[j],f)) |
| 4326 | { | ||
| 4327 | ✗ | return qe_invalid; | |
| 4328 | } | ||
| 4329 | 22628 | } | |
| 4330 | |||
| 4331 | //flags | ||
| 4332 |
2/2✓ Branch 0 taken 11314 times.
✓ Branch 1 taken 5657 times.
|
16971 | for(int32_t j=0; j<2; j++) |
| 4333 | { | ||
| 4334 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 11314 times.
|
11314 | if(!p_getc(&tempDoorComboSet.flags[j],f)) |
| 4335 | { | ||
| 4336 | ✗ | return qe_invalid; | |
| 4337 | } | ||
| 4338 | 11314 | } | |
| 4339 | |||
| 4340 |
2/2✓ Branch 0 taken 5617 times.
✓ Branch 1 taken 40 times.
|
5657 | if(Header->zelda_version < 0x193) |
| 4341 | { | ||
| 4342 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 40 times.
|
40 | if(!pfread(&tempDoorComboSet.expansion,sizeof(tempDoorComboSet.expansion),f)) |
| 4343 | { | ||
| 4344 | ✗ | return qe_invalid; | |
| 4345 | } | ||
| 4346 | 40 | } | |
| 4347 | |||
| 4348 |
2/2✓ Branch 0 taken 14 times.
✓ Branch 1 taken 5643 times.
|
5657 | if (!should_skip) |
| 4349 | 5643 | memcpy(&DoorComboSets[i], &tempDoorComboSet, sizeof(tempDoorComboSet)); | |
| 4350 | 5657 | } | |
| 4351 | |||
| 4352 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 676 times.
|
677 | if (!should_skip) |
| 4353 | 676 | door_combo_set_count=temp_door_combo_set_count; | |
| 4354 | |||
| 4355 | 677 | return 0; | |
| 4356 | 695 | } | |
| 4357 | |||
| 4358 | 6 | int32_t count_dmaps() | |
| 4359 | { | ||
| 4360 | 6 | int32_t i=MAXDMAPS-1; | |
| 4361 | 6 | bool found=false; | |
| 4362 | |||
| 4363 |
4/4✓ Branch 0 taken 6 times.
✓ Branch 1 taken 12 times.
✓ Branch 2 taken 12 times.
✓ Branch 3 taken 6 times.
|
6 | while(i>=0 && !found) |
| 4364 | { | ||
| 4365 |
4/6✓ Branch 0 taken 6 times.
✓ Branch 1 taken 6 times.
✓ Branch 2 taken 6 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 6 times.
✗ Branch 5 not taken.
|
18 | if((DMaps[i].map!=0)||(DMaps[i].level!=0)||(DMaps[i].xoff!=0)|| |
| 4366 |
3/6✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 6 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 6 times.
✗ Branch 5 not taken.
|
6 | (DMaps[i].compass!=0)||(DMaps[i].color!=0)||(DMaps[i].midi!=0)|| |
| 4367 |
1/2✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
|
6 | (DMaps[i].cont!=0)||(DMaps[i].type!=0)) |
| 4368 | 12 | found=true; | |
| 4369 | |||
| 4370 |
2/2✓ Branch 0 taken 48 times.
✓ Branch 1 taken 12 times.
|
60 | for(int32_t j=0; j<8; j++) |
| 4371 | { | ||
| 4372 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 48 times.
|
48 | if(DMaps[i].grid[j]!=0) |
| 4373 | |||
| 4374 | ✗ | found=true; | |
| 4375 | 48 | } | |
| 4376 | |||
| 4377 |
5/6✓ Branch 0 taken 6 times.
✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 6 times.
✓ Branch 4 taken 6 times.
✓ Branch 5 taken 6 times.
|
12 | if((DMaps[i].name[0]!=0)||(DMaps[i].title[0]!=0)|| |
| 4378 | ✗ | (DMaps[i].intro[0]!=0)||(DMaps[i].tmusic[0]!=0)) | |
| 4379 | 18 | found=true; | |
| 4380 | |||
| 4381 |
3/4✓ Branch 0 taken 6 times.
✓ Branch 1 taken 6 times.
✓ Branch 2 taken 6 times.
✗ Branch 3 not taken.
|
18 | if((DMaps[i].minimap_1_tile!=0)||(DMaps[i].minimap_2_tile!=0)|| |
| 4382 |
2/4✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 6 times.
✗ Branch 3 not taken.
|
6 | (DMaps[i].largemap_1_tile!=0)||(DMaps[i].largemap_2_tile!=0)|| |
| 4383 |
2/4✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 6 times.
✗ Branch 3 not taken.
|
6 | (DMaps[i].minimap_1_cset!=0)||(DMaps[i].minimap_2_cset!=0)|| |
| 4384 |
1/2✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
|
6 | (DMaps[i].largemap_1_cset!=0)||(DMaps[i].largemap_2_cset!=0)) |
| 4385 | 12 | found=true; | |
| 4386 | |||
| 4387 | ✗ | if(!found) | |
| 4388 | { | ||
| 4389 | ✗ | i--; | |
| 4390 | ✗ | } | |
| 4391 | } | ||
| 4392 | |||
| 4393 | 6 | return i+1; | |
| 4394 | } | ||
| 4395 | |||
| 4396 | |||
| 4397 | 6 | int32_t count_shops(miscQdata *Misc) | |
| 4398 | { | ||
| 4399 | 6 | int32_t i=NUM_SHOPS-1,j; | |
| 4400 | 6 | bool found=false; | |
| 4401 | |||
| 4402 |
4/4✓ Branch 0 taken 2 times.
✓ Branch 1 taken 1480 times.
✓ Branch 2 taken 1476 times.
✓ Branch 3 taken 6 times.
|
1482 | while(i>=0 && !found) |
| 4403 | { | ||
| 4404 | 1476 | j=2; | |
| 4405 | |||
| 4406 |
4/4✓ Branch 0 taken 1472 times.
✓ Branch 1 taken 4424 times.
✓ Branch 2 taken 4420 times.
✓ Branch 3 taken 1476 times.
|
5896 | while(j>=0 && !found) |
| 4407 | { | ||
| 4408 |
3/4✓ Branch 0 taken 4416 times.
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 4416 times.
|
4420 | if((Misc->shop[i].hasitem[j]!=0)||(Misc->shop[i].price[j]!=0)) |
| 4409 | { | ||
| 4410 | 4 | found=true; | |
| 4411 | 4 | } | |
| 4412 | else | ||
| 4413 | { | ||
| 4414 | 4416 | j--; | |
| 4415 | } | ||
| 4416 | } | ||
| 4417 | |||
| 4418 |
1/2✓ Branch 0 taken 1476 times.
✗ Branch 1 not taken.
|
1476 | if(Misc->shop[i].name[0]!=0) |
| 4419 | { | ||
| 4420 | ✗ | found=true; | |
| 4421 | ✗ | } | |
| 4422 | |||
| 4423 |
2/2✓ Branch 0 taken 4 times.
✓ Branch 1 taken 1472 times.
|
1476 | if(!found) |
| 4424 | { | ||
| 4425 | 1472 | i--; | |
| 4426 | 1472 | } | |
| 4427 | } | ||
| 4428 | |||
| 4429 | 6 | return i+1; | |
| 4430 | } | ||
| 4431 | |||
| 4432 | 6 | int32_t count_infos(miscQdata *Misc) | |
| 4433 | { | ||
| 4434 | 6 | int32_t i=255,j; | |
| 4435 | 6 | bool found=false; | |
| 4436 | |||
| 4437 |
4/4✓ Branch 0 taken 2 times.
✓ Branch 1 taken 1480 times.
✓ Branch 2 taken 1476 times.
✓ Branch 3 taken 6 times.
|
1482 | while(i>=0 && !found) |
| 4438 | { | ||
| 4439 | 1476 | j=2; | |
| 4440 | |||
| 4441 |
4/4✓ Branch 0 taken 1472 times.
✓ Branch 1 taken 4424 times.
✓ Branch 2 taken 4420 times.
✓ Branch 3 taken 1476 times.
|
5896 | while(j>=0 && !found) |
| 4442 | { | ||
| 4443 |
4/4✓ Branch 0 taken 4419 times.
✓ Branch 1 taken 1 times.
✓ Branch 2 taken 3 times.
✓ Branch 3 taken 4416 times.
|
4420 | if((Misc->info[i].str[j]!=0)||(Misc->info[i].price[j]!=0)) |
| 4444 | { | ||
| 4445 | 4 | found=true; | |
| 4446 | 4 | } | |
| 4447 | else | ||
| 4448 | { | ||
| 4449 | 4416 | j--; | |
| 4450 | } | ||
| 4451 | } | ||
| 4452 | |||
| 4453 |
1/2✓ Branch 0 taken 1476 times.
✗ Branch 1 not taken.
|
1476 | if(Misc->info[i].name[0]!=0) |
| 4454 | { | ||
| 4455 | ✗ | found=true; | |
| 4456 | ✗ | } | |
| 4457 | |||
| 4458 |
2/2✓ Branch 0 taken 4 times.
✓ Branch 1 taken 1472 times.
|
1476 | if(!found) |
| 4459 | { | ||
| 4460 | 1472 | i--; | |
| 4461 | 1472 | } | |
| 4462 | } | ||
| 4463 | |||
| 4464 | 6 | return i+1; | |
| 4465 | } | ||
| 4466 | |||
| 4467 | 6 | int32_t count_warprings(miscQdata *Misc) | |
| 4468 | { | ||
| 4469 | 6 | int32_t i=15,j; | |
| 4470 | 6 | bool found=false; | |
| 4471 | |||
| 4472 |
3/4✗ Branch 0 not taken.
✓ Branch 1 taken 36 times.
✓ Branch 2 taken 30 times.
✓ Branch 3 taken 6 times.
|
36 | while(i>=0 && !found) |
| 4473 | { | ||
| 4474 | 30 | j=7; | |
| 4475 | |||
| 4476 |
4/4✓ Branch 0 taken 24 times.
✓ Branch 1 taken 222 times.
✓ Branch 2 taken 216 times.
✓ Branch 3 taken 30 times.
|
246 | while(j>=0 && !found) |
| 4477 | { | ||
| 4478 |
4/4✓ Branch 0 taken 213 times.
✓ Branch 1 taken 3 times.
✓ Branch 2 taken 3 times.
✓ Branch 3 taken 210 times.
|
216 | if((Misc->warp[i].dmap[j]!=0)||(Misc->warp[i].scr[j]!=0)) |
| 4479 | { | ||
| 4480 | 6 | found=true; | |
| 4481 | 6 | } | |
| 4482 | else | ||
| 4483 | { | ||
| 4484 | 210 | j--; | |
| 4485 | } | ||
| 4486 | } | ||
| 4487 | |||
| 4488 |
2/2✓ Branch 0 taken 6 times.
✓ Branch 1 taken 24 times.
|
30 | if(!found) |
| 4489 | { | ||
| 4490 | 24 | i--; | |
| 4491 | 24 | } | |
| 4492 | } | ||
| 4493 | |||
| 4494 | 6 | return i+1; | |
| 4495 | } | ||
| 4496 | |||
| 4497 | 6 | int32_t count_palcycles(miscQdata *Misc) | |
| 4498 | { | ||
| 4499 | 6 | int32_t i=255,j; | |
| 4500 | 6 | bool found=false; | |
| 4501 | |||
| 4502 |
4/4✓ Branch 0 taken 2 times.
✓ Branch 1 taken 1406 times.
✓ Branch 2 taken 1402 times.
✓ Branch 3 taken 6 times.
|
1408 | while(i>=0 && !found) |
| 4503 | { | ||
| 4504 | 1402 | j=2; | |
| 4505 | |||
| 4506 |
4/4✓ Branch 0 taken 1398 times.
✓ Branch 1 taken 4202 times.
✓ Branch 2 taken 4198 times.
✓ Branch 3 taken 1402 times.
|
5600 | while(j>=0 && !found) |
| 4507 | { | ||
| 4508 |
2/2✓ Branch 0 taken 4 times.
✓ Branch 1 taken 4194 times.
|
4198 | if(Misc->cycles[i][j].count!=0) |
| 4509 | { | ||
| 4510 | 4 | found=true; | |
| 4511 | 4 | } | |
| 4512 | else | ||
| 4513 | { | ||
| 4514 | 4194 | j--; | |
| 4515 | } | ||
| 4516 | } | ||
| 4517 | |||
| 4518 |
2/2✓ Branch 0 taken 4 times.
✓ Branch 1 taken 1398 times.
|
1402 | if(!found) |
| 4519 | { | ||
| 4520 | 1398 | i--; | |
| 4521 | 1398 | } | |
| 4522 | } | ||
| 4523 | |||
| 4524 | 6 | return i+1; | |
| 4525 | } | ||
| 4526 | |||
| 4527 | 1336767 | void clear_screen(mapscr *temp_scr) | |
| 4528 | { | ||
| 4529 | 1336767 | temp_scr->zero_memory(); | |
| 4530 | 1336767 | } | |
| 4531 | |||
| 4532 | // NOTE: when modifying this, you need to also update: | ||
| 4533 | // readonedmap, readdmaps, and FFScript::read_dmaps | ||
| 4534 | // (and their associated write functions) | ||
| 4535 | 3767 | int32_t readdmaps(PACKFILE *f, zquestheader *Header, word, word, word start_dmap, word max_dmaps) | |
| 4536 | { | ||
| 4537 |
2/2✓ Branch 0 taken 3743 times.
✓ Branch 1 taken 24 times.
|
3767 | bool should_skip = legacy_skip_flags && get_bit(legacy_skip_flags, skip_dmaps); |
| 4538 | |||
| 4539 | 3767 | word dmapstoread=0; | |
| 4540 | 3767 | dmap tempDMap; | |
| 4541 | |||
| 4542 | int32_t dummy; | ||
| 4543 | 3767 | word s_version=0, s_cversion=0; | |
| 4544 | byte padding; | ||
| 4545 | |||
| 4546 | char legacy_title[22]; | ||
| 4547 | |||
| 4548 |
2/2✓ Branch 0 taken 3073 times.
✓ Branch 1 taken 694 times.
|
3767 | if (!should_skip) |
| 4549 |
2/2✓ Branch 0 taken 355328 times.
✓ Branch 1 taken 694 times.
|
356022 | for(int32_t i=0; i<max_dmaps; i++) |
| 4550 | { | ||
| 4551 |
1/2✓ Branch 0 taken 355328 times.
✗ Branch 1 not taken.
|
355328 | DMaps[start_dmap + i].clear(); |
| 4552 | 355328 | sprintf(legacy_title," "); | |
| 4553 | 355328 | sprintf(DMaps[start_dmap+i].intro," "); | |
| 4554 | 355328 | DMaps[start_dmap+i].type |= dmCAVE; | |
| 4555 | 356022 | } | |
| 4556 | |||
| 4557 |
4/4✓ Branch 0 taken 695 times.
✓ Branch 1 taken 3072 times.
✓ Branch 2 taken 671 times.
✓ Branch 3 taken 24 times.
|
3767 | if(!Header || Header->zelda_version > 0x192) |
| 4558 | { | ||
| 4559 | //section version info | ||
| 4560 |
3/4✓ Branch 0 taken 671 times.
✓ Branch 1 taken 3072 times.
✓ Branch 2 taken 671 times.
✗ Branch 3 not taken.
|
3743 | if(!p_igetw(&s_version,f)) |
| 4561 | { | ||
| 4562 | ✗ | return qe_invalid; | |
| 4563 | } | ||
| 4564 | |||
| 4565 | 671 | FFCore.quest_format[vDMaps] = s_version; | |
| 4566 | |||
| 4567 | //al_trace("DMaps version %d\n", s_version); | ||
| 4568 | |||
| 4569 |
2/4✓ Branch 0 taken 671 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 671 times.
✗ Branch 3 not taken.
|
671 | if(!p_igetw(&s_cversion,f)) |
| 4570 | { | ||
| 4571 | ✗ | return qe_invalid; | |
| 4572 | } | ||
| 4573 | |||
| 4574 | //section size | ||
| 4575 |
2/4✓ Branch 0 taken 671 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 671 times.
✗ Branch 3 not taken.
|
671 | if(!p_igetl(&dummy,f)) |
| 4576 | { | ||
| 4577 | ✗ | return qe_invalid; | |
| 4578 | } | ||
| 4579 | |||
| 4580 | //finally... section data | ||
| 4581 |
2/4✓ Branch 0 taken 671 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 671 times.
✗ Branch 3 not taken.
|
671 | if(!p_igetw(&dmapstoread,f)) |
| 4582 | { | ||
| 4583 | ✗ | return qe_invalid; | |
| 4584 | } | ||
| 4585 | 671 | } | |
| 4586 | else | ||
| 4587 | { | ||
| 4588 |
3/4✓ Branch 0 taken 6 times.
✓ Branch 1 taken 18 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 6 times.
|
30 | if((Header->zelda_version < 0x192)|| |
| 4589 |
1/2✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
|
6 | ((Header->zelda_version == 0x192)&&(Header->build<5))) |
| 4590 | { | ||
| 4591 | 18 | dmapstoread=32; | |
| 4592 | 18 | } | |
| 4593 |
1/2✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
|
6 | else if(s_version <= 4) |
| 4594 | { | ||
| 4595 | 6 | dmapstoread=OLDMAXDMAPS; | |
| 4596 | 6 | } | |
| 4597 | else | ||
| 4598 | { | ||
| 4599 | ✗ | dmapstoread=MAXDMAPS; | |
| 4600 | } | ||
| 4601 | } | ||
| 4602 | |||
| 4603 |
2/2✓ Branch 0 taken 83 times.
✓ Branch 1 taken 612 times.
|
695 | dmapstoread=zc_min(dmapstoread, max_dmaps); |
| 4604 |
2/2✓ Branch 0 taken 83 times.
✓ Branch 1 taken 612 times.
|
695 | dmapstoread=zc_min(dmapstoread, MAXDMAPS-start_dmap); |
| 4605 | |||
| 4606 |
2/2✓ Branch 0 taken 330560 times.
✓ Branch 1 taken 695 times.
|
331255 | for(int32_t i=start_dmap; i<dmapstoread+start_dmap; i++) |
| 4607 | { | ||
| 4608 |
1/2✓ Branch 0 taken 330560 times.
✗ Branch 1 not taken.
|
330560 | tempDMap.clear(); |
| 4609 | 330560 | sprintf(legacy_title," "); | |
| 4610 | 330560 | sprintf(tempDMap.intro," "); | |
| 4611 | |||
| 4612 |
2/4✓ Branch 0 taken 330560 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 330560 times.
✗ Branch 3 not taken.
|
330560 | if(!p_getc(&tempDMap.map,f)) |
| 4613 | { | ||
| 4614 | ✗ | return qe_invalid; | |
| 4615 | } | ||
| 4616 | |||
| 4617 |
2/2✓ Branch 0 taken 17216 times.
✓ Branch 1 taken 313344 times.
|
330560 | if(s_version <= 4) |
| 4618 | { | ||
| 4619 | byte tempbyte; | ||
| 4620 | |||
| 4621 |
2/4✓ Branch 0 taken 17216 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 17216 times.
✗ Branch 3 not taken.
|
17216 | if(!p_getc(&tempbyte,f)) |
| 4622 | { | ||
| 4623 | ✗ | return qe_invalid; | |
| 4624 | } | ||
| 4625 | |||
| 4626 | 17216 | tempDMap.level=(word)tempbyte; | |
| 4627 | 17216 | } | |
| 4628 | else | ||
| 4629 | { | ||
| 4630 |
2/4✓ Branch 0 taken 313344 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 313344 times.
✗ Branch 3 not taken.
|
313344 | if(!p_igetw(&tempDMap.level,f)) |
| 4631 | { | ||
| 4632 | ✗ | return qe_invalid; | |
| 4633 | } | ||
| 4634 | } | ||
| 4635 | |||
| 4636 |
2/4✓ Branch 0 taken 330560 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 330560 times.
✗ Branch 3 not taken.
|
330560 | if(!p_getc(&tempDMap.xoff,f)) |
| 4637 | { | ||
| 4638 | ✗ | return qe_invalid; | |
| 4639 | } | ||
| 4640 | |||
| 4641 |
2/4✓ Branch 0 taken 330560 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 330560 times.
✗ Branch 3 not taken.
|
330560 | if(!p_getc(&tempDMap.compass,f)) |
| 4642 | { | ||
| 4643 | ✗ | return qe_invalid; | |
| 4644 | } | ||
| 4645 | |||
| 4646 |
2/2✓ Branch 0 taken 313344 times.
✓ Branch 1 taken 17216 times.
|
330560 | if(s_version > 8) // February 2009 |
| 4647 | { | ||
| 4648 |
2/4✓ Branch 0 taken 313344 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 313344 times.
✗ Branch 3 not taken.
|
313344 | if(!p_igetw(&tempDMap.color,f)) |
| 4649 | { | ||
| 4650 | ✗ | return qe_invalid; | |
| 4651 | } | ||
| 4652 | 313344 | } | |
| 4653 | else | ||
| 4654 | { | ||
| 4655 | byte tempbyte; | ||
| 4656 | |||
| 4657 |
2/4✓ Branch 0 taken 17216 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 17216 times.
✗ Branch 3 not taken.
|
17216 | if(!p_getc(&tempbyte,f)) |
| 4658 | { | ||
| 4659 | ✗ | return qe_invalid; | |
| 4660 | } | ||
| 4661 | |||
| 4662 | 17216 | tempDMap.color = (word)tempbyte; | |
| 4663 | } | ||
| 4664 | |||
| 4665 |
2/4✓ Branch 0 taken 330560 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 330560 times.
✗ Branch 3 not taken.
|
330560 | if(!p_getc(&tempDMap.midi,f)) |
| 4666 | { | ||
| 4667 | ✗ | return qe_invalid; | |
| 4668 | } | ||
| 4669 | |||
| 4670 |
2/4✓ Branch 0 taken 330560 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 330560 times.
✗ Branch 3 not taken.
|
330560 | if(!p_getc(&tempDMap.cont,f)) |
| 4671 | { | ||
| 4672 | ✗ | return qe_invalid; | |
| 4673 | } | ||
| 4674 | |||
| 4675 |
2/4✓ Branch 0 taken 330560 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 330560 times.
✗ Branch 3 not taken.
|
330560 | if(!p_getc(&tempDMap.type,f)) |
| 4676 | { | ||
| 4677 | ✗ | return qe_invalid; | |
| 4678 | } | ||
| 4679 | |||
| 4680 |
4/4✓ Branch 0 taken 5487 times.
✓ Branch 1 taken 325073 times.
✓ Branch 2 taken 5443 times.
✓ Branch 3 taken 44 times.
|
336047 | if((tempDMap.type & dmfTYPE) == dmOVERW && |
| 4681 |
1/2✓ Branch 0 taken 5487 times.
✗ Branch 1 not taken.
|
5487 | (!Header || Header->zelda_version >= 0x210)) // Not sure exactly when this changed |
| 4682 | 5443 | tempDMap.xoff = 0; | |
| 4683 | |||
| 4684 |
2/2✓ Branch 0 taken 330560 times.
✓ Branch 1 taken 2644480 times.
|
2975040 | for(int32_t j=0; j<8; j++) |
| 4685 | { | ||
| 4686 |
2/4✓ Branch 0 taken 2644480 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2644480 times.
✗ Branch 3 not taken.
|
2644480 | if(!p_getc(&tempDMap.grid[j],f)) |
| 4687 | { | ||
| 4688 | ✗ | return qe_invalid; | |
| 4689 | } | ||
| 4690 | 2644480 | } | |
| 4691 | |||
| 4692 |
5/6✓ Branch 0 taken 330560 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 329984 times.
✓ Branch 3 taken 576 times.
✓ Branch 4 taken 1536 times.
✓ Branch 5 taken 328448 times.
|
330560 | if(Header && ((Header->zelda_version < 0x192)||((Header->zelda_version == 0x192)&&(Header->build<41)))) |
| 4693 | { | ||
| 4694 |
4/4✓ Branch 0 taken 137 times.
✓ Branch 1 taken 1975 times.
✓ Branch 2 taken 10 times.
✓ Branch 3 taken 127 times.
|
2112 | if(tempDMap.level>0&&tempDMap.level<10) |
| 4695 | { | ||
| 4696 | 127 | sprintf(legacy_title,"LEVEL-%d ", tempDMap.level); | |
| 4697 | 127 | } | |
| 4698 |
2/2✓ Branch 0 taken 576 times.
✓ Branch 1 taken 1536 times.
|
2112 | tempDMap.title.assign(legacy_title); |
| 4699 | |||
| 4700 |
3/4✓ Branch 0 taken 18 times.
✓ Branch 1 taken 558 times.
✓ Branch 2 taken 18 times.
✗ Branch 3 not taken.
|
576 | if(i==0 && Header->zelda_version <= 0x190) |
| 4701 | { | ||
| 4702 |
1/2✓ Branch 0 taken 18 times.
✗ Branch 1 not taken.
|
18 | tempDMap.cont = std::max((int)tempDMap.cont - tempDMap.xoff, 0); |
| 4703 |
1/2✓ Branch 0 taken 18 times.
✗ Branch 1 not taken.
|
18 | tempDMap.compass = std::max((int)tempDMap.compass - tempDMap.xoff, 0); |
| 4704 | 18 | } | |
| 4705 | |||
| 4706 | //forgotten -DD | ||
| 4707 |
2/2✓ Branch 0 taken 137 times.
✓ Branch 1 taken 439 times.
|
576 | if(tempDMap.level==0) |
| 4708 | { | ||
| 4709 | 439 | tempDMap.flags=dmfCAVES|dmf3STAIR|dmfWHIRLWIND|dmfGUYCAVES; | |
| 4710 | 439 | } | |
| 4711 | 576 | } | |
| 4712 | else | ||
| 4713 | { | ||
| 4714 |
3/4✓ Branch 0 taken 329984 times.
✓ Branch 1 taken 1536 times.
✓ Branch 2 taken 329984 times.
✗ Branch 3 not taken.
|
328448 | if(!p_getstr(tempDMap.name,sizeof(DMaps[0].name) - 1,f)) |
| 4715 | { | ||
| 4716 | ✗ | return qe_invalid; | |
| 4717 | } | ||
| 4718 | |||
| 4719 |
2/2✓ Branch 0 taken 122624 times.
✓ Branch 1 taken 207360 times.
|
329984 | if(s_version<20) |
| 4720 | { | ||
| 4721 |
2/4✓ Branch 0 taken 122624 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 122624 times.
✗ Branch 3 not taken.
|
122624 | if (!p_getstr(legacy_title, sizeof(legacy_title) - 1, f)) |
| 4722 | { | ||
| 4723 | ✗ | return qe_invalid; | |
| 4724 | } | ||
| 4725 |
1/2✓ Branch 0 taken 122624 times.
✗ Branch 1 not taken.
|
122624 | tempDMap.title.assign(legacy_title); |
| 4726 | 122624 | } | |
| 4727 | else | ||
| 4728 | { | ||
| 4729 |
2/4✓ Branch 0 taken 207360 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 207360 times.
✗ Branch 3 not taken.
|
207360 | if (!p_getwstr(&tempDMap.title, f)) |
| 4730 | { | ||
| 4731 | ✗ | return qe_invalid; | |
| 4732 | } | ||
| 4733 | } | ||
| 4734 | |||
| 4735 |
2/4✓ Branch 0 taken 329984 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 329984 times.
✗ Branch 3 not taken.
|
329984 | if(!p_getstr(tempDMap.intro,sizeof(DMaps[0].intro)-1,f)) |
| 4736 | { | ||
| 4737 | ✗ | return qe_invalid; | |
| 4738 | } | ||
| 4739 | |||
| 4740 |
5/8✓ Branch 0 taken 329984 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 329984 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1536 times.
✓ Branch 5 taken 328448 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 1536 times.
|
329984 | if(Header && ((Header->zelda_version < 0x192)||((Header->zelda_version == 0x192)&&(Header->build<152)))) |
| 4741 | { | ||
| 4742 | ✗ | if ((tempDMap.type & dmfTYPE) == dmOVERW) tempDMap.flags = dmfCAVES | dmf3STAIR | dmfWHIRLWIND | dmfGUYCAVES; | |
| 4743 | ✗ | DMaps[i] = tempDMap; | |
| 4744 | |||
| 4745 | ✗ | continue; | |
| 4746 | } | ||
| 4747 | |||
| 4748 |
3/4✓ Branch 0 taken 329984 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1536 times.
✓ Branch 3 taken 328448 times.
|
329984 | if(Header && (Header->zelda_version < 0x193)) |
| 4749 | { | ||
| 4750 |
2/4✓ Branch 0 taken 1536 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1536 times.
✗ Branch 3 not taken.
|
1536 | if(!p_getc(&padding,f)) |
| 4751 | { | ||
| 4752 | ✗ | return qe_invalid; | |
| 4753 | } | ||
| 4754 | 1536 | } | |
| 4755 |
2/2✓ Branch 0 taken 216576 times.
✓ Branch 1 taken 113408 times.
|
329984 | if ( s_version >= 11 ) |
| 4756 | { | ||
| 4757 |
2/4✓ Branch 0 taken 216576 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 216576 times.
✗ Branch 3 not taken.
|
216576 | if(!p_igetl(&tempDMap.minimap_1_tile,f)) |
| 4758 | { | ||
| 4759 | ✗ | return qe_invalid; | |
| 4760 | } | ||
| 4761 | 216576 | } | |
| 4762 | else | ||
| 4763 | { | ||
| 4764 |
2/4✓ Branch 0 taken 113408 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 113408 times.
✗ Branch 3 not taken.
|
113408 | if(!p_igetw(&tempDMap.minimap_1_tile,f)) |
| 4765 | { | ||
| 4766 | ✗ | return qe_invalid; | |
| 4767 | } | ||
| 4768 | } | ||
| 4769 | |||
| 4770 |
2/4✓ Branch 0 taken 329984 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 329984 times.
✗ Branch 3 not taken.
|
329984 | if(!p_getc(&tempDMap.minimap_1_cset,f)) |
| 4771 | { | ||
| 4772 | ✗ | return qe_invalid; | |
| 4773 | } | ||
| 4774 | |||
| 4775 |
3/4✓ Branch 0 taken 329984 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1536 times.
✓ Branch 3 taken 328448 times.
|
329984 | if(Header && (Header->zelda_version < 0x193)) |
| 4776 | { | ||
| 4777 |
2/4✓ Branch 0 taken 1536 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1536 times.
✗ Branch 3 not taken.
|
1536 | if(!p_getc(&padding,f)) |
| 4778 | { | ||
| 4779 | ✗ | return qe_invalid; | |
| 4780 | } | ||
| 4781 | 1536 | } | |
| 4782 | |||
| 4783 |
2/2✓ Branch 0 taken 216576 times.
✓ Branch 1 taken 113408 times.
|
329984 | if ( s_version >= 11 ) |
| 4784 | { | ||
| 4785 |
2/4✓ Branch 0 taken 216576 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 216576 times.
✗ Branch 3 not taken.
|
216576 | if(!p_igetl(&tempDMap.minimap_2_tile,f)) |
| 4786 | { | ||
| 4787 | ✗ | return qe_invalid; | |
| 4788 | } | ||
| 4789 | 216576 | } | |
| 4790 | else | ||
| 4791 | { | ||
| 4792 |
2/4✓ Branch 0 taken 113408 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 113408 times.
✗ Branch 3 not taken.
|
113408 | if(!p_igetw(&tempDMap.minimap_2_tile,f)) |
| 4793 | { | ||
| 4794 | ✗ | return qe_invalid; | |
| 4795 | } | ||
| 4796 | } | ||
| 4797 |
2/4✓ Branch 0 taken 329984 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 329984 times.
✗ Branch 3 not taken.
|
329984 | if(!p_getc(&tempDMap.minimap_2_cset,f)) |
| 4798 | { | ||
| 4799 | ✗ | return qe_invalid; | |
| 4800 | } | ||
| 4801 | |||
| 4802 |
3/4✓ Branch 0 taken 329984 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1536 times.
✓ Branch 3 taken 328448 times.
|
329984 | if(Header && (Header->zelda_version < 0x193)) |
| 4803 | { | ||
| 4804 |
2/4✓ Branch 0 taken 1536 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1536 times.
✗ Branch 3 not taken.
|
1536 | if(!p_getc(&padding,f)) |
| 4805 | { | ||
| 4806 | ✗ | return qe_invalid; | |
| 4807 | } | ||
| 4808 | 1536 | } | |
| 4809 | |||
| 4810 |
2/2✓ Branch 0 taken 216576 times.
✓ Branch 1 taken 113408 times.
|
329984 | if ( s_version >= 11 ) |
| 4811 | { | ||
| 4812 |
2/4✓ Branch 0 taken 216576 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 216576 times.
✗ Branch 3 not taken.
|
216576 | if(!p_igetl(&tempDMap.largemap_1_tile,f)) |
| 4813 | { | ||
| 4814 | ✗ | return qe_invalid; | |
| 4815 | } | ||
| 4816 | 216576 | } | |
| 4817 | else | ||
| 4818 | { | ||
| 4819 |
2/4✓ Branch 0 taken 113408 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 113408 times.
✗ Branch 3 not taken.
|
113408 | if(!p_igetw(&tempDMap.largemap_1_tile,f)) |
| 4820 | { | ||
| 4821 | ✗ | return qe_invalid; | |
| 4822 | } | ||
| 4823 | } | ||
| 4824 | |||
| 4825 |
2/4✓ Branch 0 taken 329984 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 329984 times.
✗ Branch 3 not taken.
|
329984 | if(!p_getc(&tempDMap.largemap_1_cset,f)) |
| 4826 | { | ||
| 4827 | ✗ | return qe_invalid; | |
| 4828 | } | ||
| 4829 | |||
| 4830 |
3/4✓ Branch 0 taken 329984 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1536 times.
✓ Branch 3 taken 328448 times.
|
329984 | if(Header && (Header->zelda_version < 0x193)) |
| 4831 | { | ||
| 4832 | |||
| 4833 |
2/4✓ Branch 0 taken 1536 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1536 times.
✗ Branch 3 not taken.
|
1536 | if(!p_getc(&padding,f)) |
| 4834 | { | ||
| 4835 | ✗ | return qe_invalid; | |
| 4836 | } | ||
| 4837 | 1536 | } | |
| 4838 | |||
| 4839 |
2/2✓ Branch 0 taken 216576 times.
✓ Branch 1 taken 113408 times.
|
329984 | if ( s_version >= 11 ) |
| 4840 | { | ||
| 4841 |
2/4✓ Branch 0 taken 216576 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 216576 times.
✗ Branch 3 not taken.
|
216576 | if(!p_igetl(&tempDMap.largemap_2_tile,f)) |
| 4842 | { | ||
| 4843 | ✗ | return qe_invalid; | |
| 4844 | } | ||
| 4845 | 216576 | } | |
| 4846 | else | ||
| 4847 | { | ||
| 4848 |
2/4✓ Branch 0 taken 113408 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 113408 times.
✗ Branch 3 not taken.
|
113408 | if(!p_igetw(&tempDMap.largemap_2_tile,f)) |
| 4849 | { | ||
| 4850 | ✗ | return qe_invalid; | |
| 4851 | } | ||
| 4852 | } | ||
| 4853 |
2/4✓ Branch 0 taken 329984 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 329984 times.
✗ Branch 3 not taken.
|
329984 | if(!p_getc(&tempDMap.largemap_2_cset,f)) |
| 4854 | { | ||
| 4855 | ✗ | return qe_invalid; | |
| 4856 | } | ||
| 4857 | |||
| 4858 |
2/4✓ Branch 0 taken 329984 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 329984 times.
✗ Branch 3 not taken.
|
329984 | if(!p_getstr(tempDMap.tmusic,sizeof(DMaps[0].tmusic)-1,f)) |
| 4859 | { | ||
| 4860 | ✗ | return qe_invalid; | |
| 4861 | } | ||
| 4862 | } | ||
| 4863 | |||
| 4864 |
2/2✓ Branch 0 taken 313344 times.
✓ Branch 1 taken 17216 times.
|
330560 | if(s_version>1) |
| 4865 | { | ||
| 4866 |
2/4✓ Branch 0 taken 313344 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 313344 times.
✗ Branch 3 not taken.
|
313344 | if(!p_getc(&tempDMap.tmusictrack,f)) |
| 4867 | { | ||
| 4868 | ✗ | return qe_invalid; | |
| 4869 | } | ||
| 4870 | |||
| 4871 |
2/4✓ Branch 0 taken 313344 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 313344 times.
✗ Branch 3 not taken.
|
313344 | if(!p_getc(&tempDMap.active_subscreen,f)) |
| 4872 | { | ||
| 4873 | ✗ | return qe_invalid; | |
| 4874 | } | ||
| 4875 | |||
| 4876 |
2/4✓ Branch 0 taken 313344 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 313344 times.
✗ Branch 3 not taken.
|
313344 | if(!p_getc(&tempDMap.passive_subscreen,f)) |
| 4877 | { | ||
| 4878 | ✗ | return qe_invalid; | |
| 4879 | } | ||
| 4880 | 313344 | } | |
| 4881 | |||
| 4882 |
2/2✓ Branch 0 taken 313344 times.
✓ Branch 1 taken 17216 times.
|
330560 | if(s_version>2) |
| 4883 | { | ||
| 4884 | byte di[32]; | ||
| 4885 | |||
| 4886 |
2/4✓ Branch 0 taken 313344 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 313344 times.
✗ Branch 3 not taken.
|
313344 | if(!pfread(&di, 32, f)) return qe_invalid; |
| 4887 | |||
| 4888 |
2/2✓ Branch 0 taken 80216064 times.
✓ Branch 1 taken 313344 times.
|
80529408 | for(int32_t j=0; j<MAXITEMS; j++) |
| 4889 | { | ||
| 4890 |
2/2✓ Branch 0 taken 9038 times.
✓ Branch 1 taken 80207026 times.
|
80216064 | if(di[j/8] & (1 << (j%8))) tempDMap.disableditems[j]=1; |
| 4891 | 80207026 | else tempDMap.disableditems[j]=0; | |
| 4892 | 80216064 | } | |
| 4893 | 313344 | } | |
| 4894 | |||
| 4895 |
2/2✓ Branch 0 taken 313344 times.
✓ Branch 1 taken 17216 times.
|
330560 | if(s_version >= 6) |
| 4896 | { | ||
| 4897 |
2/4✓ Branch 0 taken 313344 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 313344 times.
✗ Branch 3 not taken.
|
313344 | if(!p_igetl(&tempDMap.flags,f)) |
| 4898 | { | ||
| 4899 | ✗ | return qe_invalid; | |
| 4900 | } | ||
| 4901 | 313344 | } | |
| 4902 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 17216 times.
|
17216 | else if(s_version>3) |
| 4903 | { | ||
| 4904 | char temp; | ||
| 4905 | |||
| 4906 | ✗ | if(!p_getc(&temp,f)) | |
| 4907 | { | ||
| 4908 | ✗ | return qe_invalid; | |
| 4909 | } | ||
| 4910 | |||
| 4911 | ✗ | tempDMap.flags = temp; | |
| 4912 | ✗ | } | |
| 4913 |
3/8✓ Branch 0 taken 8992 times.
✓ Branch 1 taken 8224 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 8992 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
|
17216 | else if(tempDMap.level==0 && ((Header->zelda_version < 0x211) || ((Header->zelda_version == 0x211) && (Header->build<18)))) |
| 4914 | { | ||
| 4915 | 8992 | tempDMap.flags=dmfCAVES|dmf3STAIR|dmfWHIRLWIND|dmfGUYCAVES; | |
| 4916 | 8992 | } | |
| 4917 | else | ||
| 4918 | 8224 | tempDMap.flags=0; | |
| 4919 | |||
| 4920 |
2/2✓ Branch 0 taken 313344 times.
✓ Branch 1 taken 17216 times.
|
330560 | if(s_version<7) |
| 4921 | { | ||
| 4922 |
5/6✓ Branch 0 taken 8992 times.
✓ Branch 1 taken 8224 times.
✓ Branch 2 taken 8992 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 2846 times.
✓ Branch 5 taken 6146 times.
|
17216 | if(tempDMap.level==0 && get_bit(deprecated_rules,14)) |
| 4923 | 6146 | tempDMap.flags|= dmfVIEWMAP; | |
| 4924 | 17216 | } | |
| 4925 | |||
| 4926 |
2/2✓ Branch 0 taken 313344 times.
✓ Branch 1 taken 17216 times.
|
330560 | if(s_version<8) |
| 4927 | { | ||
| 4928 |
4/4✓ Branch 0 taken 8992 times.
✓ Branch 1 taken 8224 times.
✓ Branch 2 taken 942 times.
✓ Branch 3 taken 8050 times.
|
17216 | if(tempDMap.level==0 && (tempDMap.type&dmfTYPE)==dmDNGN) |
| 4929 | { | ||
| 4930 | 8050 | tempDMap.type &= ~dmDNGN; | |
| 4931 | 8050 | tempDMap.type |= dmCAVE; | |
| 4932 | 8050 | } | |
| 4933 |
2/2✓ Branch 0 taken 6834 times.
✓ Branch 1 taken 2332 times.
|
9166 | else if((tempDMap.type&dmfTYPE)==dmCAVE) |
| 4934 | { | ||
| 4935 | 2332 | tempDMap.flags |= dmfMINIMAPCOLORFIX; | |
| 4936 | 2332 | } | |
| 4937 | 17216 | } | |
| 4938 | |||
| 4939 |
7/8✓ Branch 0 taken 330560 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2112 times.
✓ Branch 3 taken 328448 times.
✓ Branch 4 taken 1536 times.
✓ Branch 5 taken 576 times.
✓ Branch 6 taken 1536 times.
✓ Branch 7 taken 328448 times.
|
330560 | if(Header && ((Header->zelda_version > 0x192)||((Header->zelda_version == 0x192)&&(Header->build>=41))) |
| 4940 | 329984 | && (Header->zelda_version < 0x193)) | |
| 4941 | { | ||
| 4942 |
2/4✓ Branch 0 taken 1536 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1536 times.
✗ Branch 3 not taken.
|
1536 | if(!p_getc(&padding,f)) |
| 4943 | { | ||
| 4944 | ✗ | return qe_invalid; | |
| 4945 | } | ||
| 4946 | 1536 | } | |
| 4947 | |||
| 4948 |
2/2✓ Branch 0 taken 113984 times.
✓ Branch 1 taken 216576 times.
|
330560 | if(s_version >= 10) |
| 4949 | { | ||
| 4950 |
2/4✓ Branch 0 taken 216576 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 216576 times.
✗ Branch 3 not taken.
|
216576 | if(!p_getc(&tempDMap.sideview,f)) |
| 4951 | { | ||
| 4952 | ✗ | return qe_invalid; | |
| 4953 | } | ||
| 4954 | 216576 | } | |
| 4955 |
2/2✓ Branch 0 taken 216576 times.
✓ Branch 1 taken 113984 times.
|
330560 | if(s_version < 10) tempDMap.sideview = 0; |
| 4956 | |||
| 4957 | //Dmap Scripts | ||
| 4958 |
2/2✓ Branch 0 taken 216576 times.
✓ Branch 1 taken 113984 times.
|
330560 | if(s_version >= 12) |
| 4959 | { | ||
| 4960 |
2/4✓ Branch 0 taken 216576 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 216576 times.
✗ Branch 3 not taken.
|
216576 | if(!p_igetw(&tempDMap.script,f)) |
| 4961 | { | ||
| 4962 | ✗ | return qe_invalid; | |
| 4963 | } | ||
| 4964 |
2/2✓ Branch 0 taken 1732608 times.
✓ Branch 1 taken 216576 times.
|
1949184 | for ( int32_t q = 0; q < 8; q++ ) |
| 4965 | { | ||
| 4966 |
2/4✓ Branch 0 taken 1732608 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1732608 times.
✗ Branch 3 not taken.
|
1732608 | if(!p_igetl(&tempDMap.initD[q],f)) |
| 4967 | { | ||
| 4968 | ✗ | return qe_invalid; | |
| 4969 | } | ||
| 4970 | 1732608 | } | |
| 4971 | 216576 | } | |
| 4972 |
2/2✓ Branch 0 taken 216576 times.
✓ Branch 1 taken 113984 times.
|
330560 | if ( s_version < 12 ) |
| 4973 | { | ||
| 4974 | 113984 | tempDMap.script = 0; | |
| 4975 |
2/2✓ Branch 0 taken 911872 times.
✓ Branch 1 taken 113984 times.
|
1025856 | for ( int32_t q = 0; q < 8; q++ ) |
| 4976 | { | ||
| 4977 | 911872 | tempDMap.initD[q] = 0; | |
| 4978 | 911872 | } | |
| 4979 | 113984 | } | |
| 4980 | |||
| 4981 |
2/2✓ Branch 0 taken 113984 times.
✓ Branch 1 taken 216576 times.
|
330560 | if(s_version >= 13) |
| 4982 | { | ||
| 4983 |
2/2✓ Branch 0 taken 1732608 times.
✓ Branch 1 taken 216576 times.
|
1949184 | for ( int32_t q = 0; q < 8; q++ ) |
| 4984 | { | ||
| 4985 |
2/2✓ Branch 0 taken 112619520 times.
✓ Branch 1 taken 1732608 times.
|
114352128 | for ( int32_t w = 0; w < 65; w++ ) |
| 4986 | { | ||
| 4987 |
2/4✓ Branch 0 taken 112619520 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 112619520 times.
✗ Branch 3 not taken.
|
112619520 | if(!p_getc(&tempDMap.initD_label[q][w],f)) |
| 4988 | { | ||
| 4989 | ✗ | return qe_invalid; | |
| 4990 | } | ||
| 4991 | 112619520 | } | |
| 4992 | 1732608 | } | |
| 4993 | 216576 | } | |
| 4994 |
2/2✓ Branch 0 taken 216576 times.
✓ Branch 1 taken 113984 times.
|
330560 | if ( s_version < 13 ) |
| 4995 | { | ||
| 4996 | 113984 | tempDMap.script = 0; | |
| 4997 |
2/2✓ Branch 0 taken 911872 times.
✓ Branch 1 taken 113984 times.
|
1025856 | for ( int32_t q = 0; q < 8; q++ ) |
| 4998 | { | ||
| 4999 |
2/2✓ Branch 0 taken 59271680 times.
✓ Branch 1 taken 911872 times.
|
60183552 | for ( int32_t w = 0; w < 65; w++ ) |
| 5000 | 59271680 | tempDMap.initD_label[q][w] = 0; | |
| 5001 | 911872 | } | |
| 5002 | 113984 | } | |
| 5003 |
2/2✓ Branch 0 taken 216576 times.
✓ Branch 1 taken 113984 times.
|
330560 | if(s_version >= 14) |
| 5004 | { | ||
| 5005 |
2/4✓ Branch 0 taken 216576 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 216576 times.
✗ Branch 3 not taken.
|
216576 | if(!p_igetw(&tempDMap.active_sub_script,f)) |
| 5006 | { | ||
| 5007 | ✗ | return qe_invalid; | |
| 5008 | } | ||
| 5009 |
2/4✓ Branch 0 taken 216576 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 216576 times.
✗ Branch 3 not taken.
|
216576 | if(!p_igetw(&tempDMap.passive_sub_script,f)) |
| 5010 | { | ||
| 5011 | ✗ | return qe_invalid; | |
| 5012 | } | ||
| 5013 |
2/2✓ Branch 0 taken 1732608 times.
✓ Branch 1 taken 216576 times.
|
1949184 | for ( int32_t q = 0; q < 8; ++q ) |
| 5014 | { | ||
| 5015 |
2/4✓ Branch 0 taken 1732608 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1732608 times.
✗ Branch 3 not taken.
|
1732608 | if(!p_igetl(&tempDMap.sub_initD[q],f)) |
| 5016 | { | ||
| 5017 | ✗ | return qe_invalid; | |
| 5018 | } | ||
| 5019 | 1732608 | } | |
| 5020 |
2/2✓ Branch 0 taken 1732608 times.
✓ Branch 1 taken 216576 times.
|
1949184 | for(int32_t q = 0; q < 8; ++q) |
| 5021 | { | ||
| 5022 |
2/2✓ Branch 0 taken 112619520 times.
✓ Branch 1 taken 1732608 times.
|
114352128 | for ( int32_t w = 0; w < 65; ++w ) |
| 5023 | { | ||
| 5024 |
2/4✓ Branch 0 taken 112619520 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 112619520 times.
✗ Branch 3 not taken.
|
112619520 | if(!p_getc(&tempDMap.sub_initD_label[q][w],f)) |
| 5025 | { | ||
| 5026 | ✗ | return qe_invalid; | |
| 5027 | } | ||
| 5028 | 112619520 | } | |
| 5029 | 1732608 | } | |
| 5030 | 216576 | } | |
| 5031 | else | ||
| 5032 | { | ||
| 5033 | 113984 | tempDMap.active_sub_script = 0; | |
| 5034 | 113984 | tempDMap.passive_sub_script = 0; | |
| 5035 |
2/2✓ Branch 0 taken 911872 times.
✓ Branch 1 taken 113984 times.
|
1025856 | for(int32_t q = 0; q < 8; ++q) |
| 5036 | { | ||
| 5037 | 911872 | tempDMap.sub_initD[q] = 0; | |
| 5038 |
2/2✓ Branch 0 taken 59271680 times.
✓ Branch 1 taken 911872 times.
|
60183552 | for(int32_t w = 0; w < 65; ++w) |
| 5039 | 59271680 | tempDMap.sub_initD_label[q][w] = 0; | |
| 5040 | 911872 | } | |
| 5041 | } | ||
| 5042 |
2/2✓ Branch 0 taken 216576 times.
✓ Branch 1 taken 113984 times.
|
330560 | if(s_version >= 15) |
| 5043 | { | ||
| 5044 |
2/4✓ Branch 0 taken 216576 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 216576 times.
✗ Branch 3 not taken.
|
216576 | if(!p_igetw(&tempDMap.onmap_script,f)) |
| 5045 | { | ||
| 5046 | ✗ | return qe_invalid; | |
| 5047 | } | ||
| 5048 |
2/2✓ Branch 0 taken 1732608 times.
✓ Branch 1 taken 216576 times.
|
1949184 | for ( int32_t q = 0; q < 8; ++q ) |
| 5049 | { | ||
| 5050 |
2/4✓ Branch 0 taken 1732608 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1732608 times.
✗ Branch 3 not taken.
|
1732608 | if(!p_igetl(&tempDMap.onmap_initD[q],f)) |
| 5051 | { | ||
| 5052 | ✗ | return qe_invalid; | |
| 5053 | } | ||
| 5054 | 1732608 | } | |
| 5055 |
2/2✓ Branch 0 taken 1732608 times.
✓ Branch 1 taken 216576 times.
|
1949184 | for(int32_t q = 0; q < 8; ++q) |
| 5056 | { | ||
| 5057 |
2/2✓ Branch 0 taken 112619520 times.
✓ Branch 1 taken 1732608 times.
|
114352128 | for ( int32_t w = 0; w < 65; ++w ) |
| 5058 | { | ||
| 5059 |
2/4✓ Branch 0 taken 112619520 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 112619520 times.
✗ Branch 3 not taken.
|
112619520 | if(!p_getc(&tempDMap.onmap_initD_label[q][w],f)) |
| 5060 | { | ||
| 5061 | ✗ | return qe_invalid; | |
| 5062 | } | ||
| 5063 | 112619520 | } | |
| 5064 | 1732608 | } | |
| 5065 | 216576 | } | |
| 5066 | else | ||
| 5067 | { | ||
| 5068 | 113984 | tempDMap.onmap_script = 0; | |
| 5069 |
2/2✓ Branch 0 taken 911872 times.
✓ Branch 1 taken 113984 times.
|
1025856 | for(int32_t q = 0; q < 8; ++q) |
| 5070 | { | ||
| 5071 | 911872 | tempDMap.onmap_initD[q] = 0; | |
| 5072 |
2/2✓ Branch 0 taken 59271680 times.
✓ Branch 1 taken 911872 times.
|
60183552 | for(int32_t w = 0; w < 65; ++w) |
| 5073 | { | ||
| 5074 | 59271680 | tempDMap.onmap_initD_label[q][w] = 0; | |
| 5075 | 59271680 | } | |
| 5076 | 911872 | } | |
| 5077 | } | ||
| 5078 |
2/2✓ Branch 0 taken 216576 times.
✓ Branch 1 taken 113984 times.
|
330560 | if(s_version >= 16) |
| 5079 | { | ||
| 5080 |
2/4✓ Branch 0 taken 216576 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 216576 times.
✗ Branch 3 not taken.
|
216576 | if(!p_igetw(&tempDMap.mirrorDMap,f)) |
| 5081 | { | ||
| 5082 | ✗ | return qe_invalid; | |
| 5083 | } | ||
| 5084 | 216576 | } | |
| 5085 | else | ||
| 5086 | { | ||
| 5087 | 113984 | tempDMap.mirrorDMap = -1; | |
| 5088 | } | ||
| 5089 | |||
| 5090 |
2/2✓ Branch 0 taken 123200 times.
✓ Branch 1 taken 207360 times.
|
330560 | if (s_version >= 17) |
| 5091 | { | ||
| 5092 | // Reserved for z3. | ||
| 5093 | 207360 | } | |
| 5094 | |||
| 5095 | // Enhanced music loop points | ||
| 5096 |
2/2✓ Branch 0 taken 207360 times.
✓ Branch 1 taken 123200 times.
|
330560 | if (s_version >= 18) |
| 5097 | { | ||
| 5098 |
2/4✓ Branch 0 taken 207360 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 207360 times.
✗ Branch 3 not taken.
|
207360 | if (!p_igetl(&tempDMap.tmusic_loop_start, f)) |
| 5099 | { | ||
| 5100 | ✗ | return qe_invalid; | |
| 5101 | } | ||
| 5102 |
2/4✓ Branch 0 taken 207360 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 207360 times.
✗ Branch 3 not taken.
|
207360 | if (!p_igetl(&tempDMap.tmusic_loop_end, f)) |
| 5103 | { | ||
| 5104 | ✗ | return qe_invalid; | |
| 5105 | } | ||
| 5106 |
2/4✓ Branch 0 taken 207360 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 207360 times.
✗ Branch 3 not taken.
|
207360 | if (!p_igetl(&tempDMap.tmusic_xfade_in, f)) |
| 5107 | { | ||
| 5108 | ✗ | return qe_invalid; | |
| 5109 | } | ||
| 5110 |
2/4✓ Branch 0 taken 207360 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 207360 times.
✗ Branch 3 not taken.
|
207360 | if (!p_igetl(&tempDMap.tmusic_xfade_out, f)) |
| 5111 | { | ||
| 5112 | ✗ | return qe_invalid; | |
| 5113 | } | ||
| 5114 | 207360 | } | |
| 5115 | else | ||
| 5116 | { | ||
| 5117 | 123200 | tempDMap.tmusic_loop_start = 0; | |
| 5118 | 123200 | tempDMap.tmusic_loop_end = 0; | |
| 5119 | 123200 | tempDMap.tmusic_xfade_in = 0; | |
| 5120 | 123200 | tempDMap.tmusic_xfade_out = 0; | |
| 5121 | } | ||
| 5122 | |||
| 5123 |
2/2✓ Branch 0 taken 207360 times.
✓ Branch 1 taken 123200 times.
|
330560 | if(s_version >= 19) |
| 5124 |
2/4✓ Branch 0 taken 207360 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 207360 times.
✗ Branch 3 not taken.
|
207360 | if(!p_getc(&tempDMap.overlay_subscreen, f)) |
| 5125 | ✗ | return qe_invalid; | |
| 5126 | |||
| 5127 |
2/2✓ Branch 0 taken 207360 times.
✓ Branch 1 taken 123200 times.
|
330560 | if (s_version >= 20) |
| 5128 | { | ||
| 5129 |
2/4✓ Branch 0 taken 207360 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 207360 times.
✗ Branch 3 not taken.
|
207360 | if (!p_igetl(&tempDMap.intro_string_id, f)) |
| 5130 | ✗ | return qe_invalid; | |
| 5131 | 207360 | } | |
| 5132 | else | ||
| 5133 | 123200 | tempDMap.intro_string_id = 0; | |
| 5134 | |||
| 5135 | // Reserved for z3. | ||
| 5136 |
2/2✓ Branch 0 taken 123200 times.
✓ Branch 1 taken 207360 times.
|
330560 | if(s_version >= 21) |
| 5137 | { | ||
| 5138 |
2/2✓ Branch 0 taken 1658880 times.
✓ Branch 1 taken 207360 times.
|
1866240 | for(int32_t j=0; j<8; j++) |
| 5139 | { | ||
| 5140 |
2/2✓ Branch 0 taken 13271040 times.
✓ Branch 1 taken 1658880 times.
|
14929920 | for(int32_t k=0; k<8; k++) |
| 5141 | { | ||
| 5142 | char c; | ||
| 5143 |
2/4✓ Branch 0 taken 13271040 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 13271040 times.
✗ Branch 3 not taken.
|
13271040 | if(!p_getc(&c,f)) |
| 5144 | { | ||
| 5145 | ✗ | return qe_invalid; | |
| 5146 | } | ||
| 5147 | 13271040 | } | |
| 5148 | 1658880 | } | |
| 5149 | 207360 | } | |
| 5150 | |||
| 5151 |
2/2✓ Branch 0 taken 330304 times.
✓ Branch 1 taken 256 times.
|
330560 | if (!should_skip) |
| 5152 | { | ||
| 5153 |
1/2✓ Branch 0 taken 330304 times.
✗ Branch 1 not taken.
|
330304 | if(loading_tileset_flags & TILESET_CLEARMAPS) |
| 5154 | ✗ | tempDMap.map = 0; | |
| 5155 |
1/2✓ Branch 0 taken 330304 times.
✗ Branch 1 not taken.
|
330304 | if(loading_tileset_flags & TILESET_CLEARSCRIPTS) |
| 5156 | { | ||
| 5157 | ✗ | tempDMap.script = 0; | |
| 5158 | ✗ | for(int q = 0; q < 8; ++q) | |
| 5159 | ✗ | tempDMap.initD[q] = 0; | |
| 5160 | ✗ | } | |
| 5161 |
1/2✓ Branch 0 taken 330304 times.
✗ Branch 1 not taken.
|
330304 | DMaps[i] = tempDMap; |
| 5162 | 330304 | } | |
| 5163 | 330560 | } | |
| 5164 | |||
| 5165 | 695 | return 0; | |
| 5166 | 6839 | } | |
| 5167 | |||
| 5168 | 612 | int32_t readmisccolors(PACKFILE *f, zquestheader *Header, miscQdata *Misc) | |
| 5169 | { | ||
| 5170 | //these are here to bypass compiler warnings about unused arguments | ||
| 5171 | 612 | Header=Header; | |
| 5172 | |||
| 5173 | miscQdata temp_misc; | ||
| 5174 | 612 | word s_version=0, s_cversion=0; | |
| 5175 | 612 | int32_t tempsize=0; | |
| 5176 | word dummyw; | ||
| 5177 | |||
| 5178 | 612 | memcpy(&temp_misc,Misc,sizeof(temp_misc)); | |
| 5179 | |||
| 5180 | //section version info | ||
| 5181 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 612 times.
|
612 | if(!p_igetw(&s_version,f)) |
| 5182 | { | ||
| 5183 | ✗ | return qe_invalid; | |
| 5184 | } | ||
| 5185 | |||
| 5186 | 612 | FFCore.quest_format[vColours] = s_version; | |
| 5187 | |||
| 5188 | 612 | al_trace("Misc Colours section version: %d\n", s_version); | |
| 5189 | |||
| 5190 | //al_trace("Misc. colors version %d\n", s_version); | ||
| 5191 |
1/2✓ Branch 0 taken 612 times.
✗ Branch 1 not taken.
|
612 | if(!p_igetw(&s_cversion,f)) |
| 5192 | { | ||
| 5193 | ✗ | return qe_invalid; | |
| 5194 | } | ||
| 5195 | |||
| 5196 | |||
| 5197 | //section size | ||
| 5198 |
1/2✓ Branch 0 taken 612 times.
✗ Branch 1 not taken.
|
612 | if(!p_igetl(&tempsize,f)) |
| 5199 | { | ||
| 5200 | ✗ | return qe_invalid; | |
| 5201 | } | ||
| 5202 | |||
| 5203 | //finally... section data | ||
| 5204 | 612 | readsize=0; | |
| 5205 | |||
| 5206 |
1/2✓ Branch 0 taken 612 times.
✗ Branch 1 not taken.
|
612 | if(!p_getc(&temp_misc.colors.text,f)) |
| 5207 | { | ||
| 5208 | ✗ | return qe_invalid; | |
| 5209 | } | ||
| 5210 | |||
| 5211 |
1/2✓ Branch 0 taken 612 times.
✗ Branch 1 not taken.
|
612 | if(!p_getc(&temp_misc.colors.caption,f)) |
| 5212 | { | ||
| 5213 | ✗ | return qe_invalid; | |
| 5214 | } | ||
| 5215 | |||
| 5216 |
1/2✓ Branch 0 taken 612 times.
✗ Branch 1 not taken.
|
612 | if(!p_getc(&temp_misc.colors.overw_bg,f)) |
| 5217 | { | ||
| 5218 | ✗ | return qe_invalid; | |
| 5219 | } | ||
| 5220 | |||
| 5221 |
1/2✓ Branch 0 taken 612 times.
✗ Branch 1 not taken.
|
612 | if(!p_getc(&temp_misc.colors.dngn_bg,f)) |
| 5222 | { | ||
| 5223 | ✗ | return qe_invalid; | |
| 5224 | } | ||
| 5225 | |||
| 5226 |
1/2✓ Branch 0 taken 612 times.
✗ Branch 1 not taken.
|
612 | if(!p_getc(&temp_misc.colors.dngn_fg,f)) |
| 5227 | { | ||
| 5228 | ✗ | return qe_invalid; | |
| 5229 | } | ||
| 5230 | |||
| 5231 |
1/2✓ Branch 0 taken 612 times.
✗ Branch 1 not taken.
|
612 | if(!p_getc(&temp_misc.colors.cave_fg,f)) |
| 5232 | { | ||
| 5233 | ✗ | return qe_invalid; | |
| 5234 | } | ||
| 5235 | |||
| 5236 |
1/2✓ Branch 0 taken 612 times.
✗ Branch 1 not taken.
|
612 | if(!p_getc(&temp_misc.colors.bs_dk,f)) |
| 5237 | { | ||
| 5238 | ✗ | return qe_invalid; | |
| 5239 | } | ||
| 5240 | |||
| 5241 |
1/2✓ Branch 0 taken 612 times.
✗ Branch 1 not taken.
|
612 | if(!p_getc(&temp_misc.colors.bs_goal,f)) |
| 5242 | { | ||
| 5243 | ✗ | return qe_invalid; | |
| 5244 | } | ||
| 5245 | |||
| 5246 |
1/2✓ Branch 0 taken 612 times.
✗ Branch 1 not taken.
|
612 | if(!p_getc(&temp_misc.colors.compass_lt,f)) |
| 5247 | { | ||
| 5248 | ✗ | return qe_invalid; | |
| 5249 | } | ||
| 5250 | |||
| 5251 |
1/2✓ Branch 0 taken 612 times.
✗ Branch 1 not taken.
|
612 | if(!p_getc(&temp_misc.colors.compass_dk,f)) |
| 5252 | { | ||
| 5253 | ✗ | return qe_invalid; | |
| 5254 | } | ||
| 5255 | |||
| 5256 |
1/2✓ Branch 0 taken 612 times.
✗ Branch 1 not taken.
|
612 | if(!p_getc(&temp_misc.colors.subscr_bg,f)) |
| 5257 | { | ||
| 5258 | ✗ | return qe_invalid; | |
| 5259 | } | ||
| 5260 | |||
| 5261 |
1/2✓ Branch 0 taken 612 times.
✗ Branch 1 not taken.
|
612 | if(!p_getc(&temp_misc.colors.triframe_color,f)) |
| 5262 | { | ||
| 5263 | ✗ | return qe_invalid; | |
| 5264 | } | ||
| 5265 | |||
| 5266 |
1/2✓ Branch 0 taken 612 times.
✗ Branch 1 not taken.
|
612 | if(!p_getc(&temp_misc.colors.hero_dot,f)) |
| 5267 | { | ||
| 5268 | ✗ | return qe_invalid; | |
| 5269 | } | ||
| 5270 | |||
| 5271 |
1/2✓ Branch 0 taken 612 times.
✗ Branch 1 not taken.
|
612 | if(!p_getc(&temp_misc.colors.bmap_bg,f)) |
| 5272 | { | ||
| 5273 | ✗ | return qe_invalid; | |
| 5274 | } | ||
| 5275 | |||
| 5276 |
1/2✓ Branch 0 taken 612 times.
✗ Branch 1 not taken.
|
612 | if(!p_getc(&temp_misc.colors.bmap_fg,f)) |
| 5277 | { | ||
| 5278 | ✗ | return qe_invalid; | |
| 5279 | } | ||
| 5280 | |||
| 5281 |
1/2✓ Branch 0 taken 612 times.
✗ Branch 1 not taken.
|
612 | if(!p_getc(&temp_misc.colors.triforce_cset,f)) |
| 5282 | { | ||
| 5283 | ✗ | return qe_invalid; | |
| 5284 | } | ||
| 5285 | |||
| 5286 |
1/2✓ Branch 0 taken 612 times.
✗ Branch 1 not taken.
|
612 | if(!p_getc(&temp_misc.colors.triframe_cset,f)) |
| 5287 | { | ||
| 5288 | ✗ | return qe_invalid; | |
| 5289 | } | ||
| 5290 | |||
| 5291 |
1/2✓ Branch 0 taken 612 times.
✗ Branch 1 not taken.
|
612 | if(!p_getc(&temp_misc.colors.overworld_map_cset,f)) |
| 5292 | { | ||
| 5293 | ✗ | return qe_invalid; | |
| 5294 | } | ||
| 5295 | |||
| 5296 |
1/2✓ Branch 0 taken 612 times.
✗ Branch 1 not taken.
|
612 | if(!p_getc(&temp_misc.colors.dungeon_map_cset,f)) |
| 5297 | { | ||
| 5298 | ✗ | return qe_invalid; | |
| 5299 | } | ||
| 5300 | |||
| 5301 |
1/2✓ Branch 0 taken 612 times.
✗ Branch 1 not taken.
|
612 | if(!p_getc(&temp_misc.colors.blueframe_cset,f)) |
| 5302 | { | ||
| 5303 | ✗ | return qe_invalid; | |
| 5304 | } | ||
| 5305 |
2/2✓ Branch 0 taken 423 times.
✓ Branch 1 taken 189 times.
|
612 | if(s_version < 4) |
| 5306 | { | ||
| 5307 |
1/2✓ Branch 0 taken 189 times.
✗ Branch 1 not taken.
|
189 | if(!p_igetw(&dummyw,f)) |
| 5308 | ✗ | return qe_invalid; | |
| 5309 | 189 | temp_misc.colors.triforce_tile = dummyw; | |
| 5310 | |||
| 5311 |
1/2✓ Branch 0 taken 189 times.
✗ Branch 1 not taken.
|
189 | if(!p_igetw(&dummyw,f)) |
| 5312 | ✗ | return qe_invalid; | |
| 5313 | 189 | temp_misc.colors.triframe_tile = dummyw; | |
| 5314 | |||
| 5315 |
1/2✓ Branch 0 taken 189 times.
✗ Branch 1 not taken.
|
189 | if(!p_igetw(&dummyw,f)) |
| 5316 | ✗ | return qe_invalid; | |
| 5317 | 189 | temp_misc.colors.overworld_map_tile = dummyw; | |
| 5318 | |||
| 5319 |
1/2✓ Branch 0 taken 189 times.
✗ Branch 1 not taken.
|
189 | if(!p_igetw(&dummyw,f)) |
| 5320 | ✗ | return qe_invalid; | |
| 5321 | 189 | temp_misc.colors.dungeon_map_tile = dummyw; | |
| 5322 | |||
| 5323 |
1/2✓ Branch 0 taken 189 times.
✗ Branch 1 not taken.
|
189 | if(!p_igetw(&dummyw,f)) |
| 5324 | ✗ | return qe_invalid; | |
| 5325 | 189 | temp_misc.colors.blueframe_tile = dummyw; | |
| 5326 | |||
| 5327 |
1/2✓ Branch 0 taken 189 times.
✗ Branch 1 not taken.
|
189 | if(!p_igetw(&dummyw,f)) |
| 5328 | ✗ | return qe_invalid; | |
| 5329 | 189 | temp_misc.colors.HCpieces_tile = dummyw; | |
| 5330 | 189 | } | |
| 5331 | |||
| 5332 |
1/2✓ Branch 0 taken 612 times.
✗ Branch 1 not taken.
|
612 | if(!p_getc(&temp_misc.colors.HCpieces_cset,f)) |
| 5333 | { | ||
| 5334 | ✗ | return qe_invalid; | |
| 5335 | } | ||
| 5336 | |||
| 5337 |
1/2✓ Branch 0 taken 612 times.
✗ Branch 1 not taken.
|
612 | if(!p_getc(&temp_misc.colors.subscr_shadow,f)) |
| 5338 | { | ||
| 5339 | ✗ | return qe_invalid; | |
| 5340 | } | ||
| 5341 | |||
| 5342 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 612 times.
|
612 | if(s_version < 2) |
| 5343 | { | ||
| 5344 | ✗ | temp_misc.colors.msgtext = 0x01; | |
| 5345 | ✗ | } | |
| 5346 | else | ||
| 5347 | { | ||
| 5348 |
1/2✓ Branch 0 taken 612 times.
✗ Branch 1 not taken.
|
612 | if(!p_getc(&temp_misc.colors.msgtext, f)) |
| 5349 | { | ||
| 5350 | ✗ | return qe_invalid; | |
| 5351 | } | ||
| 5352 | } | ||
| 5353 | |||
| 5354 |
2/2✓ Branch 0 taken 189 times.
✓ Branch 1 taken 423 times.
|
612 | if ( s_version >= 3 ) //expanded tile pages to 825 |
| 5355 | { | ||
| 5356 |
1/2✓ Branch 0 taken 423 times.
✗ Branch 1 not taken.
|
423 | if(!p_igetl(&temp_misc.colors.triforce_tile,f)) |
| 5357 | { | ||
| 5358 | ✗ | return qe_invalid; | |
| 5359 | } | ||
| 5360 | |||
| 5361 |
1/2✓ Branch 0 taken 423 times.
✗ Branch 1 not taken.
|
423 | if(!p_igetl(&temp_misc.colors.triframe_tile,f)) |
| 5362 | { | ||
| 5363 | ✗ | return qe_invalid; | |
| 5364 | } | ||
| 5365 | |||
| 5366 |
1/2✓ Branch 0 taken 423 times.
✗ Branch 1 not taken.
|
423 | if(!p_igetl(&temp_misc.colors.overworld_map_tile,f)) |
| 5367 | { | ||
| 5368 | ✗ | return qe_invalid; | |
| 5369 | } | ||
| 5370 | |||
| 5371 |
1/2✓ Branch 0 taken 423 times.
✗ Branch 1 not taken.
|
423 | if(!p_igetl(&temp_misc.colors.dungeon_map_tile,f)) |
| 5372 | { | ||
| 5373 | ✗ | return qe_invalid; | |
| 5374 | } | ||
| 5375 | |||
| 5376 |
1/2✓ Branch 0 taken 423 times.
✗ Branch 1 not taken.
|
423 | if(!p_igetl(&temp_misc.colors.blueframe_tile,f)) |
| 5377 | { | ||
| 5378 | ✗ | return qe_invalid; | |
| 5379 | } | ||
| 5380 | |||
| 5381 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 423 times.
|
423 | if(!p_igetl(&temp_misc.colors.HCpieces_tile,f)) |
| 5382 | { | ||
| 5383 | ✗ | return qe_invalid; | |
| 5384 | } | ||
| 5385 | 423 | } | |
| 5386 | |||
| 5387 | 612 | memcpy(Misc, &temp_misc, sizeof(temp_misc)); | |
| 5388 | |||
| 5389 | 612 | return 0; | |
| 5390 | 612 | } | |
| 5391 | |||
| 5392 | 612 | int32_t readgameicons(PACKFILE *f, zquestheader *, miscQdata *Misc) | |
| 5393 | { | ||
| 5394 | miscQdata temp_misc; | ||
| 5395 | 612 | word s_version=0, s_cversion=0; | |
| 5396 | byte icons; | ||
| 5397 | 612 | int32_t tempsize=0; | |
| 5398 | |||
| 5399 | 612 | memcpy(&temp_misc,Misc,sizeof(temp_misc)); | |
| 5400 | |||
| 5401 | //section version info | ||
| 5402 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 612 times.
|
612 | if(!p_igetw(&s_version,f)) |
| 5403 | { | ||
| 5404 | ✗ | return qe_invalid; | |
| 5405 | } | ||
| 5406 | |||
| 5407 | 612 | FFCore.quest_format[vIcons] = s_version; | |
| 5408 | |||
| 5409 | //al_trace("Game icons version %d\n", s_version); | ||
| 5410 |
1/2✓ Branch 0 taken 612 times.
✗ Branch 1 not taken.
|
612 | if(!p_igetw(&s_cversion,f)) |
| 5411 | { | ||
| 5412 | ✗ | return qe_invalid; | |
| 5413 | } | ||
| 5414 | |||
| 5415 | |||
| 5416 | //section size | ||
| 5417 |
1/2✓ Branch 0 taken 612 times.
✗ Branch 1 not taken.
|
612 | if(!p_igetl(&tempsize,f)) |
| 5418 | { | ||
| 5419 | ✗ | return qe_invalid; | |
| 5420 | } | ||
| 5421 | |||
| 5422 | //finally... section data | ||
| 5423 | 612 | readsize=0; | |
| 5424 | |||
| 5425 | 612 | icons=4; | |
| 5426 | |||
| 5427 |
2/2✓ Branch 0 taken 423 times.
✓ Branch 1 taken 189 times.
|
612 | if ( s_version >= 10 ) |
| 5428 | { | ||
| 5429 |
2/2✓ Branch 0 taken 1692 times.
✓ Branch 1 taken 423 times.
|
2115 | for(int32_t i=0; i<icons; i++) |
| 5430 | { | ||
| 5431 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1692 times.
|
1692 | if(!p_igetl(&temp_misc.icons[i],f)) |
| 5432 | { | ||
| 5433 | ✗ | return qe_invalid; | |
| 5434 | } | ||
| 5435 | 1692 | } | |
| 5436 | 423 | } | |
| 5437 | else | ||
| 5438 | { | ||
| 5439 |
2/2✓ Branch 0 taken 756 times.
✓ Branch 1 taken 189 times.
|
945 | for(int32_t i=0; i<icons; i++) |
| 5440 | { | ||
| 5441 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 756 times.
|
756 | if(!p_igetw(&temp_misc.icons[i],f)) |
| 5442 | { | ||
| 5443 | ✗ | return qe_invalid; | |
| 5444 | } | ||
| 5445 | 756 | } | |
| 5446 | } | ||
| 5447 | |||
| 5448 | 612 | memcpy(Misc, &temp_misc, sizeof(temp_misc)); | |
| 5449 | |||
| 5450 | 612 | return 0; | |
| 5451 | 612 | } | |
| 5452 | |||
| 5453 | 695 | int32_t readmisc(PACKFILE *f, zquestheader *Header, miscQdata *Misc) | |
| 5454 | { | ||
| 5455 |
2/2✓ Branch 0 taken 671 times.
✓ Branch 1 taken 24 times.
|
695 | bool should_skip = legacy_skip_flags && get_bit(legacy_skip_flags, skip_misc); |
| 5456 | |||
| 5457 | 695 | word maxinfos=256; | |
| 5458 | 695 | word maxshops=256; | |
| 5459 | 695 | word shops=16, infos=16, warprings=8, palcycles=256, windwarps=9, triforces=8, icons=4; | |
| 5460 | 695 | word ponds=16, pondsize=72, expansionsize=98*2; | |
| 5461 | byte tempbyte, padding; | ||
| 5462 | miscQdata temp_misc; | ||
| 5463 | 695 | word s_version=0, s_cversion=0; | |
| 5464 | word swaptmp; | ||
| 5465 | 695 | int32_t tempsize=0; | |
| 5466 | |||
| 5467 | 695 | memcpy(&temp_misc,Misc,sizeof(temp_misc)); | |
| 5468 | |||
| 5469 |
2/2✓ Branch 0 taken 177920 times.
✓ Branch 1 taken 695 times.
|
178615 | for(int32_t i=0; i<maxshops; ++i) |
| 5470 | { | ||
| 5471 | 177920 | memset(&temp_misc.shop, 0, sizeof(shoptype)*256); | |
| 5472 | 177920 | } | |
| 5473 | |||
| 5474 |
2/2✓ Branch 0 taken 177920 times.
✓ Branch 1 taken 695 times.
|
178615 | for(int32_t i=0; i<maxinfos; ++i) |
| 5475 | { | ||
| 5476 | 177920 | memset(&temp_misc.info, 0, sizeof(infotype)*256); | |
| 5477 | 177920 | } | |
| 5478 | |||
| 5479 |
2/2✓ Branch 0 taken 24 times.
✓ Branch 1 taken 671 times.
|
695 | if(Header->zelda_version > 0x192) |
| 5480 | { | ||
| 5481 | //section version info | ||
| 5482 |
1/2✓ Branch 0 taken 671 times.
✗ Branch 1 not taken.
|
671 | if(!p_igetw(&s_version,f)) |
| 5483 | { | ||
| 5484 | ✗ | return qe_invalid; | |
| 5485 | } | ||
| 5486 | |||
| 5487 | 671 | FFCore.quest_format[vMisc] = s_version; | |
| 5488 | |||
| 5489 | //al_trace("Misc. data version %d\n", s_version); | ||
| 5490 |
1/2✓ Branch 0 taken 671 times.
✗ Branch 1 not taken.
|
671 | if(!p_igetw(&s_cversion,f)) |
| 5491 | { | ||
| 5492 | ✗ | return qe_invalid; | |
| 5493 | } | ||
| 5494 | |||
| 5495 | |||
| 5496 | //section size | ||
| 5497 |
1/2✓ Branch 0 taken 671 times.
✗ Branch 1 not taken.
|
671 | if(!p_igetl(&tempsize,f)) |
| 5498 | { | ||
| 5499 | ✗ | return qe_invalid; | |
| 5500 | } | ||
| 5501 | 671 | } | |
| 5502 | |||
| 5503 | //finally... section data | ||
| 5504 | 695 | readsize=0; | |
| 5505 | |||
| 5506 | //shops | ||
| 5507 |
2/2✓ Branch 0 taken 24 times.
✓ Branch 1 taken 671 times.
|
695 | if(Header->zelda_version > 0x192) |
| 5508 | { | ||
| 5509 |
1/2✓ Branch 0 taken 671 times.
✗ Branch 1 not taken.
|
671 | if(!p_igetw(&shops,f)) |
| 5510 | { | ||
| 5511 | ✗ | return qe_invalid; | |
| 5512 | } | ||
| 5513 | 671 | } | |
| 5514 | |||
| 5515 |
2/4✓ Branch 0 taken 695 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 695 times.
|
695 | if (!(shops >= 0 && shops <= NUM_SHOPS)) |
| 5516 | { | ||
| 5517 | ✗ | return qe_invalid; | |
| 5518 | } | ||
| 5519 | |||
| 5520 |
2/2✓ Branch 0 taken 9971 times.
✓ Branch 1 taken 695 times.
|
10666 | for(int32_t i=0; i<shops; i++) |
| 5521 | { | ||
| 5522 |
2/2✓ Branch 0 taken 1200 times.
✓ Branch 1 taken 8771 times.
|
9971 | if(s_version > 6) |
| 5523 | { | ||
| 5524 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 8771 times.
|
8771 | if(!p_getstr(temp_misc.shop[i].name,sizeof(temp_misc.shop[i].name)-1,f)) |
| 5525 | { | ||
| 5526 | ✗ | return qe_invalid; | |
| 5527 | } | ||
| 5528 | 8771 | } | |
| 5529 | |||
| 5530 |
2/2✓ Branch 0 taken 29913 times.
✓ Branch 1 taken 9971 times.
|
39884 | for(int32_t j=0; j<3; j++) |
| 5531 | { | ||
| 5532 |
1/2✓ Branch 0 taken 29913 times.
✗ Branch 1 not taken.
|
29913 | if(!p_getc(&temp_misc.shop[i].item[j],f)) |
| 5533 | { | ||
| 5534 | ✗ | return qe_invalid; | |
| 5535 | } | ||
| 5536 | |||
| 5537 |
2/2✓ Branch 0 taken 26313 times.
✓ Branch 1 taken 3600 times.
|
29913 | if(s_version < 4) |
| 5538 | { | ||
| 5539 | 3600 | temp_misc.shop[i].hasitem[j] = (temp_misc.shop[i].item[j] == 0) ? 0 : 1; | |
| 5540 | 3600 | } | |
| 5541 | 29913 | } | |
| 5542 | |||
| 5543 |
2/2✓ Branch 0 taken 9587 times.
✓ Branch 1 taken 384 times.
|
9971 | if(Header->zelda_version < 0x193) |
| 5544 | { | ||
| 5545 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 384 times.
|
384 | if(!p_getc(&tempbyte,f)) |
| 5546 | { | ||
| 5547 | ✗ | return qe_invalid; | |
| 5548 | } | ||
| 5549 | 384 | } | |
| 5550 | |||
| 5551 |
2/2✓ Branch 0 taken 29913 times.
✓ Branch 1 taken 9971 times.
|
39884 | for(int32_t j=0; j<3; j++) |
| 5552 | { | ||
| 5553 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 29913 times.
|
29913 | if(!p_igetw(&temp_misc.shop[i].price[j],f)) |
| 5554 | { | ||
| 5555 | ✗ | return qe_invalid; | |
| 5556 | } | ||
| 5557 | 29913 | } | |
| 5558 | |||
| 5559 |
2/2✓ Branch 0 taken 1200 times.
✓ Branch 1 taken 8771 times.
|
9971 | if(s_version > 3) |
| 5560 | { | ||
| 5561 |
2/2✓ Branch 0 taken 26313 times.
✓ Branch 1 taken 8771 times.
|
35084 | for(int32_t j=0; j<3; j++) |
| 5562 | { | ||
| 5563 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 26313 times.
|
26313 | if(!p_getc(&temp_misc.shop[i].hasitem[j],f)) |
| 5564 | ✗ | return qe_invalid; | |
| 5565 | 26313 | } | |
| 5566 | 8771 | } | |
| 5567 | |||
| 5568 | /* | ||
| 5569 | if(s_version < 8) | ||
| 5570 | { | ||
| 5571 | for(int32_t j=0; j<3; j++) | ||
| 5572 | { | ||
| 5573 | (&temp_misc.shop[i].str[j])=0; //initialise. | ||
| 5574 | } | ||
| 5575 | } | ||
| 5576 | */ | ||
| 5577 | 9971 | } | |
| 5578 | |||
| 5579 | //filter all the 0 items to the end (yeah, bubble sort; sue me) | ||
| 5580 |
2/2✓ Branch 0 taken 177920 times.
✓ Branch 1 taken 695 times.
|
178615 | for(int32_t i=0; i<maxshops; ++i) |
| 5581 | { | ||
| 5582 |
2/2✓ Branch 0 taken 355840 times.
✓ Branch 1 taken 177920 times.
|
533760 | for(int32_t j=0; j<3-1; j++) |
| 5583 | { | ||
| 5584 |
2/2✓ Branch 0 taken 355840 times.
✓ Branch 1 taken 518799 times.
|
874639 | for(int32_t k=0; k<2-j; k++) |
| 5585 | { | ||
| 5586 | 518799 | if(temp_misc.shop[i].hasitem[k]==0) | |
| 5587 | { | ||
| 5588 | 518799 | swaptmp = temp_misc.shop[i].item[k]; | |
| 5589 | 518799 | temp_misc.shop[i].item[k] = temp_misc.shop[i].item[k+1]; | |
| 5590 | 518799 | temp_misc.shop[i].item[k+1] = swaptmp; | |
| 5591 | 518799 | swaptmp = temp_misc.shop[i].price[k]; | |
| 5592 | 518799 | temp_misc.shop[i].price[k] = temp_misc.shop[i].price[k+1]; | |
| 5593 | 518799 | temp_misc.shop[i].price[k+1] = swaptmp; | |
| 5594 | 518799 | swaptmp = temp_misc.shop[i].hasitem[k]; | |
| 5595 | 518799 | temp_misc.shop[i].hasitem[k] = temp_misc.shop[i].hasitem[k+1]; | |
| 5596 | 518799 | temp_misc.shop[i].hasitem[k+1] = swaptmp; | |
| 5597 | 518799 | } | |
| 5598 | 518799 | } | |
| 5599 | 355840 | } | |
| 5600 | 177920 | } | |
| 5601 | |||
| 5602 | //infos | ||
| 5603 |
2/2✓ Branch 0 taken 24 times.
✓ Branch 1 taken 671 times.
|
695 | if(Header->zelda_version > 0x192) |
| 5604 | { | ||
| 5605 |
1/2✓ Branch 0 taken 671 times.
✗ Branch 1 not taken.
|
671 | if(!p_igetw(&infos,f)) |
| 5606 | { | ||
| 5607 | ✗ | return qe_invalid; | |
| 5608 | } | ||
| 5609 | 671 | } | |
| 5610 | |||
| 5611 |
2/4✓ Branch 0 taken 695 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 695 times.
|
695 | if (!(infos >= 0 && infos <= NUM_INFOS)) |
| 5612 | { | ||
| 5613 | ✗ | return qe_invalid; | |
| 5614 | } | ||
| 5615 | |||
| 5616 | |||
| 5617 |
2/2✓ Branch 0 taken 9301 times.
✓ Branch 1 taken 695 times.
|
9996 | for(int32_t i=0; i<infos; i++) |
| 5618 | { | ||
| 5619 |
2/2✓ Branch 0 taken 761 times.
✓ Branch 1 taken 8540 times.
|
9301 | if(s_version > 6) |
| 5620 | { | ||
| 5621 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 8540 times.
|
8540 | if(!p_getstr(temp_misc.info[i].name,sizeof(temp_misc.info[i].name)-1,f)) |
| 5622 | { | ||
| 5623 | ✗ | return qe_invalid; | |
| 5624 | } | ||
| 5625 | 8540 | } | |
| 5626 | |||
| 5627 |
2/2✓ Branch 0 taken 27903 times.
✓ Branch 1 taken 9301 times.
|
37204 | for(int32_t j=0; j<3; j++) |
| 5628 | { | ||
| 5629 |
3/4✓ Branch 0 taken 27039 times.
✓ Branch 1 taken 864 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 288 times.
|
28191 | if((Header->zelda_version < 0x192)|| |
| 5630 |
2/2✓ Branch 0 taken 288 times.
✓ Branch 1 taken 26751 times.
|
27039 | ((Header->zelda_version == 0x192)&&(Header->build<146))) |
| 5631 | { | ||
| 5632 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 864 times.
|
864 | if(!p_getc(&tempbyte,f)) |
| 5633 | { | ||
| 5634 | ✗ | return qe_invalid; | |
| 5635 | } | ||
| 5636 | |||
| 5637 | 864 | temp_misc.info[i].str[j]=tempbyte; | |
| 5638 | 864 | } | |
| 5639 | else | ||
| 5640 | { | ||
| 5641 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 27039 times.
|
27039 | if(!p_igetw(&temp_misc.info[i].str[j],f)) |
| 5642 | { | ||
| 5643 | ✗ | return qe_invalid; | |
| 5644 | } | ||
| 5645 | } | ||
| 5646 | 27903 | } | |
| 5647 | |||
| 5648 |
2/2✓ Branch 0 taken 8917 times.
✓ Branch 1 taken 384 times.
|
9301 | if(Header->zelda_version < 0x193) |
| 5649 | { | ||
| 5650 |
1/2✓ Branch 0 taken 384 times.
✗ Branch 1 not taken.
|
384 | if(!p_getc(&tempbyte,f)) |
| 5651 | { | ||
| 5652 | ✗ | return qe_invalid; | |
| 5653 | } | ||
| 5654 | 384 | } | |
| 5655 | |||
| 5656 |
3/4✓ Branch 0 taken 96 times.
✓ Branch 1 taken 9205 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 96 times.
|
9301 | if((Header->zelda_version == 0x192)&&(Header->build>145)) |
| 5657 | { | ||
| 5658 |
1/2✓ Branch 0 taken 96 times.
✗ Branch 1 not taken.
|
96 | if(!p_getc(&padding,f)) |
| 5659 | { | ||
| 5660 | ✗ | return qe_invalid; | |
| 5661 | } | ||
| 5662 | 96 | } | |
| 5663 | |||
| 5664 |
2/2✓ Branch 0 taken 27903 times.
✓ Branch 1 taken 9301 times.
|
37204 | for(int32_t j=0; j<3; j++) |
| 5665 | { | ||
| 5666 |
1/2✓ Branch 0 taken 27903 times.
✗ Branch 1 not taken.
|
27903 | if(!p_igetw(&temp_misc.info[i].price[j],f)) |
| 5667 | { | ||
| 5668 | ✗ | return qe_invalid; | |
| 5669 | } | ||
| 5670 | 27903 | } | |
| 5671 | 9301 | } | |
| 5672 | |||
| 5673 | //filter all the 0 strings to the end (yeah, bubble sort; sue me) | ||
| 5674 |
2/2✓ Branch 0 taken 177920 times.
✓ Branch 1 taken 695 times.
|
178615 | for(int32_t i=0; i<maxinfos; ++i) |
| 5675 | { | ||
| 5676 |
2/2✓ Branch 0 taken 355840 times.
✓ Branch 1 taken 177920 times.
|
533760 | for(int32_t j=0; j<3-1; j++) |
| 5677 | { | ||
| 5678 |
2/2✓ Branch 0 taken 533760 times.
✓ Branch 1 taken 355840 times.
|
889600 | for(int32_t k=0; k<2-j; k++) |
| 5679 | { | ||
| 5680 |
2/2✓ Branch 0 taken 10537 times.
✓ Branch 1 taken 523223 times.
|
533760 | if(temp_misc.info[i].str[k]==0) |
| 5681 | { | ||
| 5682 | 523223 | swaptmp = temp_misc.info[i].str[k]; | |
| 5683 | 523223 | temp_misc.info[i].str[k] = temp_misc.info[i].str[k+1]; | |
| 5684 | 523223 | temp_misc.info[i].str[k+1] = swaptmp; | |
| 5685 | 523223 | swaptmp = temp_misc.info[i].price[k]; | |
| 5686 | 523223 | temp_misc.info[i].price[k] = temp_misc.info[i].price[k+1]; | |
| 5687 | 523223 | temp_misc.info[i].price[k+1] = swaptmp; | |
| 5688 | 523223 | } | |
| 5689 | 533760 | } | |
| 5690 | 355840 | } | |
| 5691 | 177920 | } | |
| 5692 | |||
| 5693 | |||
| 5694 | //warp rings | ||
| 5695 |
2/2✓ Branch 0 taken 83 times.
✓ Branch 1 taken 612 times.
|
695 | if(s_version > 5) |
| 5696 | 612 | warprings++; | |
| 5697 | |||
| 5698 |
2/2✓ Branch 0 taken 24 times.
✓ Branch 1 taken 671 times.
|
695 | if(Header->zelda_version > 0x192) |
| 5699 | { | ||
| 5700 |
1/2✓ Branch 0 taken 671 times.
✗ Branch 1 not taken.
|
671 | if(!p_igetw(&warprings,f)) |
| 5701 | { | ||
| 5702 | ✗ | return qe_invalid; | |
| 5703 | } | ||
| 5704 | |||
| 5705 |
3/4✓ Branch 0 taken 671 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 567 times.
✓ Branch 3 taken 104 times.
|
671 | if (!(warprings >= 0 && warprings <= NUM_WARP_RINGS)) |
| 5706 | { | ||
| 5707 | // return qe_invalid; | ||
| 5708 | // Note: we can't actually fail here because for some reason, some quest files have more than the max | ||
| 5709 | // number of possible warp rings. Some examples of this are: demosp253.qst, yuurand.qst | ||
| 5710 | // So instead below we disable `keepdata` when reading the bad warp ring data, so no memory is corrupted. | ||
| 5711 | 104 | } | |
| 5712 | 671 | } | |
| 5713 | |||
| 5714 |
2/2✓ Branch 0 taken 6772 times.
✓ Branch 1 taken 695 times.
|
7467 | for(int32_t i=0; i<warprings; i++) |
| 5715 | { | ||
| 5716 | // See above comment on the `warprings` range check. | ||
| 5717 | 6772 | bool keepdata = i < NUM_WARP_RINGS; | |
| 5718 | |||
| 5719 |
2/2✓ Branch 0 taken 59828 times.
✓ Branch 1 taken 6772 times.
|
66600 | for(int32_t j=0; j<8+((s_version > 5)?1:0); j++) |
| 5720 | { | ||
| 5721 |
2/2✓ Branch 0 taken 8960 times.
✓ Branch 1 taken 50868 times.
|
59828 | if(s_version <= 3) |
| 5722 | { | ||
| 5723 |
1/2✓ Branch 0 taken 8960 times.
✗ Branch 1 not taken.
|
8960 | if(!p_getc(&tempbyte,f)) |
| 5724 | { | ||
| 5725 | ✗ | return qe_invalid; | |
| 5726 | } | ||
| 5727 | |||
| 5728 |
2/2✓ Branch 0 taken 3192 times.
✓ Branch 1 taken 5768 times.
|
8960 | if (keepdata) |
| 5729 | 5768 | temp_misc.warp[i].dmap[j]=(word)tempbyte; | |
| 5730 | 8960 | } | |
| 5731 | else | ||
| 5732 | { | ||
| 5733 | word tempword; | ||
| 5734 |
1/2✓ Branch 0 taken 50868 times.
✗ Branch 1 not taken.
|
50868 | if(!p_igetw(&tempword,f)) |
| 5735 | { | ||
| 5736 | ✗ | return qe_invalid; | |
| 5737 | } | ||
| 5738 | |||
| 5739 |
2/2✓ Branch 0 taken 1296 times.
✓ Branch 1 taken 49572 times.
|
50868 | if (keepdata) |
| 5740 | 49572 | temp_misc.warp[i].dmap[j] = tempword; | |
| 5741 | } | ||
| 5742 | 59828 | } | |
| 5743 | |||
| 5744 |
2/2✓ Branch 0 taken 59828 times.
✓ Branch 1 taken 6772 times.
|
66600 | for(int32_t j=0; j<8+((s_version > 5)?1:0); j++) |
| 5745 | { | ||
| 5746 |
1/2✓ Branch 0 taken 59828 times.
✗ Branch 1 not taken.
|
59828 | if(!p_getc(&tempbyte,f)) |
| 5747 | { | ||
| 5748 | ✗ | return qe_invalid; | |
| 5749 | } | ||
| 5750 |
2/2✓ Branch 0 taken 4488 times.
✓ Branch 1 taken 55340 times.
|
59828 | if (keepdata) |
| 5751 | 55340 | temp_misc.warp[i].scr[j] = tempbyte; | |
| 5752 | 59828 | } | |
| 5753 | |||
| 5754 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 6772 times.
|
6772 | if(!p_getc(&tempbyte,f)) |
| 5755 | { | ||
| 5756 | ✗ | return qe_invalid; | |
| 5757 | } | ||
| 5758 |
2/2✓ Branch 0 taken 543 times.
✓ Branch 1 taken 6229 times.
|
6772 | if (keepdata) |
| 5759 | 6229 | temp_misc.warp[i].size = tempbyte; | |
| 5760 | |||
| 5761 |
2/2✓ Branch 0 taken 6580 times.
✓ Branch 1 taken 192 times.
|
6772 | if(Header->zelda_version < 0x193) |
| 5762 | { | ||
| 5763 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 192 times.
|
192 | if(!p_getc(&tempbyte,f)) |
| 5764 | { | ||
| 5765 | ✗ | return qe_invalid; | |
| 5766 | } | ||
| 5767 | 192 | } | |
| 5768 | 6772 | } | |
| 5769 | |||
| 5770 | //palette cycles | ||
| 5771 |
2/2✓ Branch 0 taken 671 times.
✓ Branch 1 taken 24 times.
|
695 | if(Header->zelda_version < 0x193) //in 1.93+, palette cycling is saved with the palettes |
| 5772 | { | ||
| 5773 |
2/2✓ Branch 0 taken 6144 times.
✓ Branch 1 taken 24 times.
|
6168 | for(int32_t i=0; i<256; i++) |
| 5774 | { | ||
| 5775 |
2/2✓ Branch 0 taken 18432 times.
✓ Branch 1 taken 6144 times.
|
24576 | for(int32_t j=0; j<3; j++) |
| 5776 | { | ||
| 5777 | 18432 | temp_misc.cycles[i][j].first=0; | |
| 5778 | 18432 | temp_misc.cycles[i][j].count=0; | |
| 5779 | 18432 | temp_misc.cycles[i][j].speed=0; | |
| 5780 | 18432 | } | |
| 5781 | 6144 | } | |
| 5782 | |||
| 5783 |
3/4✓ Branch 0 taken 6 times.
✓ Branch 1 taken 18 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 6 times.
|
30 | if((Header->zelda_version < 0x192)|| |
| 5784 |
1/2✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
|
6 | ((Header->zelda_version == 0x192)&&(Header->build<73))) |
| 5785 | { | ||
| 5786 | 18 | palcycles=16; | |
| 5787 | 18 | } | |
| 5788 | |||
| 5789 |
2/2✓ Branch 0 taken 1824 times.
✓ Branch 1 taken 24 times.
|
1848 | for(int32_t i=0; i<palcycles; i++) |
| 5790 | { | ||
| 5791 |
2/2✓ Branch 0 taken 5472 times.
✓ Branch 1 taken 1824 times.
|
7296 | for(int32_t j=0; j<3; j++) |
| 5792 | { | ||
| 5793 |
1/2✓ Branch 0 taken 5472 times.
✗ Branch 1 not taken.
|
5472 | if(!p_getc(&temp_misc.cycles[i][j].first,f)) |
| 5794 | { | ||
| 5795 | ✗ | return qe_invalid; | |
| 5796 | } | ||
| 5797 | |||
| 5798 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 5472 times.
|
5472 | if(!p_getc(&temp_misc.cycles[i][j].count,f)) |
| 5799 | { | ||
| 5800 | ✗ | return qe_invalid; | |
| 5801 | } | ||
| 5802 | |||
| 5803 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 5472 times.
|
5472 | if(!p_getc(&temp_misc.cycles[i][j].speed,f)) |
| 5804 | { | ||
| 5805 | ✗ | return qe_invalid; | |
| 5806 | } | ||
| 5807 | 5472 | } | |
| 5808 | 1824 | } | |
| 5809 | 24 | } | |
| 5810 | |||
| 5811 | //Wind warps are now just another warp ring. | ||
| 5812 |
2/2✓ Branch 0 taken 612 times.
✓ Branch 1 taken 83 times.
|
695 | if(s_version <= 5) |
| 5813 | { | ||
| 5814 |
2/2✓ Branch 0 taken 24 times.
✓ Branch 1 taken 59 times.
|
83 | if(Header->zelda_version > 0x192) |
| 5815 | { | ||
| 5816 |
1/2✓ Branch 0 taken 59 times.
✗ Branch 1 not taken.
|
59 | if(!p_igetw(&windwarps,f)) |
| 5817 | { | ||
| 5818 | ✗ | return qe_invalid; | |
| 5819 | } | ||
| 5820 | 59 | } | |
| 5821 | |||
| 5822 |
2/4✓ Branch 0 taken 83 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 83 times.
|
83 | if (!(windwarps >= 0 && windwarps <= NUM_WARP_RINGS)) |
| 5823 | { | ||
| 5824 | ✗ | return qe_invalid; | |
| 5825 | } | ||
| 5826 | |||
| 5827 |
2/2✓ Branch 0 taken 665 times.
✓ Branch 1 taken 83 times.
|
748 | for(int32_t i=0; i<windwarps; i++) |
| 5828 | { | ||
| 5829 |
1/2✓ Branch 0 taken 665 times.
✗ Branch 1 not taken.
|
665 | if(s_version <= 3) |
| 5830 | { | ||
| 5831 |
1/2✓ Branch 0 taken 665 times.
✗ Branch 1 not taken.
|
665 | if(!p_getc(&tempbyte,f)) |
| 5832 | { | ||
| 5833 | ✗ | return qe_invalid; | |
| 5834 | } | ||
| 5835 | |||
| 5836 | 665 | temp_misc.warp[8].dmap[i]=tempbyte; | |
| 5837 | 665 | } | |
| 5838 | else | ||
| 5839 | { | ||
| 5840 | ✗ | if(!p_igetw(&temp_misc.warp[8].dmap[i],f)) | |
| 5841 | { | ||
| 5842 | ✗ | return qe_invalid; | |
| 5843 | } | ||
| 5844 | } | ||
| 5845 | |||
| 5846 |
1/2✓ Branch 0 taken 665 times.
✗ Branch 1 not taken.
|
665 | if(!p_getc(&temp_misc.warp[8].scr[i],f)) |
| 5847 | { | ||
| 5848 | ✗ | return qe_invalid; | |
| 5849 | } | ||
| 5850 | |||
| 5851 | 665 | temp_misc.warp[8].size = 9; | |
| 5852 | |||
| 5853 |
1/2✓ Branch 0 taken 665 times.
✗ Branch 1 not taken.
|
665 | if(s_version == 5) |
| 5854 | { | ||
| 5855 | ✗ | if(!p_getc(&tempbyte,f)) | |
| 5856 | { | ||
| 5857 | ✗ | return qe_invalid; | |
| 5858 | } | ||
| 5859 | ✗ | } | |
| 5860 | 665 | } | |
| 5861 | 83 | } | |
| 5862 | |||
| 5863 | |||
| 5864 | //triforce pieces | ||
| 5865 |
2/2✓ Branch 0 taken 5560 times.
✓ Branch 1 taken 695 times.
|
6255 | for(int32_t i=0; i<triforces; i++) |
| 5866 | { | ||
| 5867 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 5560 times.
|
5560 | if(!p_getc(&temp_misc.triforce[i],f)) |
| 5868 | { | ||
| 5869 | ✗ | return qe_invalid; | |
| 5870 | } | ||
| 5871 | 5560 | } | |
| 5872 | |||
| 5873 | //misc color data | ||
| 5874 |
2/2✓ Branch 0 taken 612 times.
✓ Branch 1 taken 83 times.
|
695 | if(s_version<3) |
| 5875 | { | ||
| 5876 |
1/2✓ Branch 0 taken 83 times.
✗ Branch 1 not taken.
|
83 | if(!p_getc(&temp_misc.colors.text,f)) |
| 5877 | { | ||
| 5878 | ✗ | return qe_invalid; | |
| 5879 | } | ||
| 5880 | |||
| 5881 |
1/2✓ Branch 0 taken 83 times.
✗ Branch 1 not taken.
|
83 | if(!p_getc(&temp_misc.colors.caption,f)) |
| 5882 | { | ||
| 5883 | ✗ | return qe_invalid; | |
| 5884 | } | ||
| 5885 | |||
| 5886 |
1/2✓ Branch 0 taken 83 times.
✗ Branch 1 not taken.
|
83 | if(!p_getc(&temp_misc.colors.overw_bg,f)) |
| 5887 | { | ||
| 5888 | ✗ | return qe_invalid; | |
| 5889 | } | ||
| 5890 | |||
| 5891 |
1/2✓ Branch 0 taken 83 times.
✗ Branch 1 not taken.
|
83 | if(!p_getc(&temp_misc.colors.dngn_bg,f)) |
| 5892 | { | ||
| 5893 | ✗ | return qe_invalid; | |
| 5894 | } | ||
| 5895 | |||
| 5896 |
1/2✓ Branch 0 taken 83 times.
✗ Branch 1 not taken.
|
83 | if(!p_getc(&temp_misc.colors.dngn_fg,f)) |
| 5897 | { | ||
| 5898 | ✗ | return qe_invalid; | |
| 5899 | } | ||
| 5900 | |||
| 5901 |
1/2✓ Branch 0 taken 83 times.
✗ Branch 1 not taken.
|
83 | if(!p_getc(&temp_misc.colors.cave_fg,f)) |
| 5902 | { | ||
| 5903 | ✗ | return qe_invalid; | |
| 5904 | } | ||
| 5905 | |||
| 5906 |
1/2✓ Branch 0 taken 83 times.
✗ Branch 1 not taken.
|
83 | if(!p_getc(&temp_misc.colors.bs_dk,f)) |
| 5907 | { | ||
| 5908 | ✗ | return qe_invalid; | |
| 5909 | } | ||
| 5910 | |||
| 5911 |
1/2✓ Branch 0 taken 83 times.
✗ Branch 1 not taken.
|
83 | if(!p_getc(&temp_misc.colors.bs_goal,f)) |
| 5912 | { | ||
| 5913 | ✗ | return qe_invalid; | |
| 5914 | } | ||
| 5915 | |||
| 5916 |
1/2✓ Branch 0 taken 83 times.
✗ Branch 1 not taken.
|
83 | if(!p_getc(&temp_misc.colors.compass_lt,f)) |
| 5917 | { | ||
| 5918 | ✗ | return qe_invalid; | |
| 5919 | } | ||
| 5920 | |||
| 5921 |
1/2✓ Branch 0 taken 83 times.
✗ Branch 1 not taken.
|
83 | if(!p_getc(&temp_misc.colors.compass_dk,f)) |
| 5922 | { | ||
| 5923 | ✗ | return qe_invalid; | |
| 5924 | } | ||
| 5925 | |||
| 5926 |
1/2✓ Branch 0 taken 83 times.
✗ Branch 1 not taken.
|
83 | if(!p_getc(&temp_misc.colors.subscr_bg,f)) |
| 5927 | { | ||
| 5928 | ✗ | return qe_invalid; | |
| 5929 | } | ||
| 5930 | |||
| 5931 |
1/2✓ Branch 0 taken 83 times.
✗ Branch 1 not taken.
|
83 | if(!p_getc(&temp_misc.colors.triframe_color,f)) |
| 5932 | { | ||
| 5933 | ✗ | return qe_invalid; | |
| 5934 | } | ||
| 5935 | |||
| 5936 |
1/2✓ Branch 0 taken 83 times.
✗ Branch 1 not taken.
|
83 | if(!p_getc(&temp_misc.colors.hero_dot,f)) |
| 5937 | { | ||
| 5938 | ✗ | return qe_invalid; | |
| 5939 | } | ||
| 5940 | |||
| 5941 |
1/2✓ Branch 0 taken 83 times.
✗ Branch 1 not taken.
|
83 | if(!p_getc(&temp_misc.colors.bmap_bg,f)) |
| 5942 | { | ||
| 5943 | ✗ | return qe_invalid; | |
| 5944 | } | ||
| 5945 | |||
| 5946 |
1/2✓ Branch 0 taken 83 times.
✗ Branch 1 not taken.
|
83 | if(!p_getc(&temp_misc.colors.bmap_fg,f)) |
| 5947 | { | ||
| 5948 | ✗ | return qe_invalid; | |
| 5949 | } | ||
| 5950 | |||
| 5951 |
1/2✓ Branch 0 taken 83 times.
✗ Branch 1 not taken.
|
83 | if(!p_getc(&temp_misc.colors.triforce_cset,f)) |
| 5952 | { | ||
| 5953 | ✗ | return qe_invalid; | |
| 5954 | } | ||
| 5955 | |||
| 5956 |
1/2✓ Branch 0 taken 83 times.
✗ Branch 1 not taken.
|
83 | if(!p_getc(&temp_misc.colors.triframe_cset,f)) |
| 5957 | { | ||
| 5958 | ✗ | return qe_invalid; | |
| 5959 | } | ||
| 5960 | |||
| 5961 |
1/2✓ Branch 0 taken 83 times.
✗ Branch 1 not taken.
|
83 | if(!p_getc(&temp_misc.colors.overworld_map_cset,f)) |
| 5962 | { | ||
| 5963 | ✗ | return qe_invalid; | |
| 5964 | } | ||
| 5965 | |||
| 5966 |
1/2✓ Branch 0 taken 83 times.
✗ Branch 1 not taken.
|
83 | if(!p_getc(&temp_misc.colors.dungeon_map_cset,f)) |
| 5967 | { | ||
| 5968 | ✗ | return qe_invalid; | |
| 5969 | } | ||
| 5970 | |||
| 5971 |
1/2✓ Branch 0 taken 83 times.
✗ Branch 1 not taken.
|
83 | if(!p_getc(&temp_misc.colors.blueframe_cset,f)) |
| 5972 | { | ||
| 5973 | ✗ | return qe_invalid; | |
| 5974 | } | ||
| 5975 | |||
| 5976 |
1/2✓ Branch 0 taken 83 times.
✗ Branch 1 not taken.
|
83 | if(!p_igetw(&temp_misc.colors.triforce_tile,f)) |
| 5977 | { | ||
| 5978 | ✗ | return qe_invalid; | |
| 5979 | } | ||
| 5980 | |||
| 5981 |
1/2✓ Branch 0 taken 83 times.
✗ Branch 1 not taken.
|
83 | if(!p_igetw(&temp_misc.colors.triframe_tile,f)) |
| 5982 | { | ||
| 5983 | ✗ | return qe_invalid; | |
| 5984 | } | ||
| 5985 | |||
| 5986 |
1/2✓ Branch 0 taken 83 times.
✗ Branch 1 not taken.
|
83 | if(!p_igetw(&temp_misc.colors.overworld_map_tile,f)) |
| 5987 | { | ||
| 5988 | ✗ | return qe_invalid; | |
| 5989 | } | ||
| 5990 | |||
| 5991 |
1/2✓ Branch 0 taken 83 times.
✗ Branch 1 not taken.
|
83 | if(!p_igetw(&temp_misc.colors.dungeon_map_tile,f)) |
| 5992 | { | ||
| 5993 | ✗ | return qe_invalid; | |
| 5994 | } | ||
| 5995 | |||
| 5996 |
1/2✓ Branch 0 taken 83 times.
✗ Branch 1 not taken.
|
83 | if(!p_igetw(&temp_misc.colors.blueframe_tile,f)) |
| 5997 | { | ||
| 5998 | ✗ | return qe_invalid; | |
| 5999 | } | ||
| 6000 | |||
| 6001 |
1/2✓ Branch 0 taken 83 times.
✗ Branch 1 not taken.
|
83 | if(!p_igetw(&temp_misc.colors.HCpieces_tile,f)) |
| 6002 | { | ||
| 6003 | ✗ | return qe_invalid; | |
| 6004 | } | ||
| 6005 | |||
| 6006 |
1/2✓ Branch 0 taken 83 times.
✗ Branch 1 not taken.
|
83 | if(!p_getc(&temp_misc.colors.HCpieces_cset,f)) |
| 6007 | { | ||
| 6008 | ✗ | return qe_invalid; | |
| 6009 | } | ||
| 6010 | |||
| 6011 | 83 | temp_misc.colors.msgtext = 0x01; | |
| 6012 | |||
| 6013 |
2/2✓ Branch 0 taken 59 times.
✓ Branch 1 taken 24 times.
|
83 | if(Header->zelda_version < 0x193) |
| 6014 | { | ||
| 6015 |
2/2✓ Branch 0 taken 168 times.
✓ Branch 1 taken 24 times.
|
192 | for(int32_t i=0; i<7; i++) |
| 6016 | { | ||
| 6017 |
1/2✓ Branch 0 taken 168 times.
✗ Branch 1 not taken.
|
168 | if(!p_getc(&tempbyte,f)) |
| 6018 | { | ||
| 6019 | ✗ | return qe_invalid; | |
| 6020 | } | ||
| 6021 | 168 | } | |
| 6022 | 24 | } | |
| 6023 | |||
| 6024 |
3/4✓ Branch 0 taken 6 times.
✓ Branch 1 taken 77 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 6 times.
|
83 | if((Header->zelda_version == 0x192)&&(Header->build>145)) |
| 6025 | { | ||
| 6026 |
2/2✓ Branch 0 taken 1536 times.
✓ Branch 1 taken 6 times.
|
1542 | for(int32_t i=0; i<256; i++) |
| 6027 | { | ||
| 6028 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1536 times.
|
1536 | if(!p_getc(&tempbyte,f)) |
| 6029 | { | ||
| 6030 | ✗ | return qe_invalid; | |
| 6031 | } | ||
| 6032 | 1536 | } | |
| 6033 | 6 | } | |
| 6034 | |||
| 6035 |
1/2✓ Branch 0 taken 83 times.
✗ Branch 1 not taken.
|
83 | if(s_version>1) |
| 6036 | { | ||
| 6037 | ✗ | if(!p_getc(&temp_misc.colors.subscr_shadow,f)) | |
| 6038 | { | ||
| 6039 | ✗ | return qe_invalid; | |
| 6040 | } | ||
| 6041 | ✗ | } | |
| 6042 | |||
| 6043 | //save game icons | ||
| 6044 |
3/4✓ Branch 0 taken 65 times.
✓ Branch 1 taken 18 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 6 times.
|
89 | if((Header->zelda_version < 0x192)|| |
| 6045 |
2/2✓ Branch 0 taken 6 times.
✓ Branch 1 taken 59 times.
|
65 | ((Header->zelda_version == 0x192)&&(Header->build<73))) |
| 6046 | { | ||
| 6047 | 18 | icons=3; | |
| 6048 | 18 | } | |
| 6049 | |||
| 6050 |
2/2✓ Branch 0 taken 314 times.
✓ Branch 1 taken 83 times.
|
397 | for(int32_t i=0; i<icons; i++) |
| 6051 | { | ||
| 6052 |
1/2✓ Branch 0 taken 314 times.
✗ Branch 1 not taken.
|
314 | if(!p_igetw(&temp_misc.icons[i],f)) |
| 6053 | { | ||
| 6054 | ✗ | return qe_invalid; | |
| 6055 | } | ||
| 6056 | 314 | } | |
| 6057 | 83 | } | |
| 6058 | |||
| 6059 |
3/4✓ Branch 0 taken 677 times.
✓ Branch 1 taken 18 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 6 times.
|
701 | if((Header->zelda_version < 0x192)|| |
| 6060 |
2/2✓ Branch 0 taken 6 times.
✓ Branch 1 taken 671 times.
|
677 | ((Header->zelda_version == 0x192)&&(Header->build<30))) |
| 6061 | { | ||
| 6062 | 18 | memcpy(Misc, &temp_misc, sizeof(temp_misc)); | |
| 6063 | |||
| 6064 | 18 | return 0; | |
| 6065 | } | ||
| 6066 | |||
| 6067 | //pond information | ||
| 6068 |
2/2✓ Branch 0 taken 671 times.
✓ Branch 1 taken 6 times.
|
677 | if(Header->zelda_version < 0x193) |
| 6069 | { | ||
| 6070 |
2/4✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 6 times.
✗ Branch 3 not taken.
|
6 | if((Header->zelda_version == 0x192)&&(Header->build<146)) |
| 6071 | { | ||
| 6072 | ✗ | pondsize=25; | |
| 6073 | ✗ | } | |
| 6074 | |||
| 6075 |
2/2✓ Branch 0 taken 96 times.
✓ Branch 1 taken 6 times.
|
102 | for(int32_t i=0; i<ponds; i++) |
| 6076 | { | ||
| 6077 |
2/2✓ Branch 0 taken 6912 times.
✓ Branch 1 taken 96 times.
|
7008 | for(int32_t j=0; j<pondsize; j++) |
| 6078 | { | ||
| 6079 |
1/2✓ Branch 0 taken 6912 times.
✗ Branch 1 not taken.
|
6912 | if(!p_getc(&tempbyte,f)) |
| 6080 | { | ||
| 6081 | ✗ | return qe_invalid; | |
| 6082 | |||
| 6083 | } | ||
| 6084 | 6912 | } | |
| 6085 | 96 | } | |
| 6086 | 6 | } | |
| 6087 | |||
| 6088 | //end string | ||
| 6089 |
2/4✓ Branch 0 taken 677 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 6 times.
|
683 | if((Header->zelda_version < 0x192)|| |
| 6090 |
2/2✓ Branch 0 taken 6 times.
✓ Branch 1 taken 671 times.
|
677 | ((Header->zelda_version == 0x192)&&(Header->build<146))) |
| 6091 | { | ||
| 6092 | ✗ | if(!p_getc(&tempbyte,f)) | |
| 6093 | { | ||
| 6094 | ✗ | return qe_invalid; | |
| 6095 | } | ||
| 6096 | |||
| 6097 | ✗ | temp_misc.endstring=tempbyte; | |
| 6098 | |||
| 6099 | ✗ | if(!p_getc(&tempbyte,f)) | |
| 6100 | { | ||
| 6101 | ✗ | return qe_invalid; | |
| 6102 | } | ||
| 6103 | ✗ | } | |
| 6104 | else | ||
| 6105 | { | ||
| 6106 |
1/2✓ Branch 0 taken 677 times.
✗ Branch 1 not taken.
|
677 | if(!p_igetw(&temp_misc.endstring,f)) |
| 6107 | { | ||
| 6108 | ✗ | return qe_invalid; | |
| 6109 | } | ||
| 6110 | } | ||
| 6111 | |||
| 6112 | //expansion | ||
| 6113 |
2/2✓ Branch 0 taken 671 times.
✓ Branch 1 taken 6 times.
|
677 | if(Header->zelda_version < 0x193) |
| 6114 | { | ||
| 6115 |
2/4✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 6 times.
✗ Branch 3 not taken.
|
6 | if((Header->zelda_version == 0x192)&&(Header->build<73)) |
| 6116 | { | ||
| 6117 | ✗ | expansionsize=99*2; | |
| 6118 | ✗ | } | |
| 6119 | |||
| 6120 |
2/2✓ Branch 0 taken 1176 times.
✓ Branch 1 taken 6 times.
|
1182 | for(int32_t i=0; i<expansionsize; i++) |
| 6121 | { | ||
| 6122 |
1/2✓ Branch 0 taken 1176 times.
✗ Branch 1 not taken.
|
1176 | if(!p_getc(&tempbyte,f)) |
| 6123 | { | ||
| 6124 | ✗ | return qe_invalid; | |
| 6125 | } | ||
| 6126 | 1176 | } | |
| 6127 | 6 | } | |
| 6128 | //shops v8 | ||
| 6129 | |||
| 6130 | |||
| 6131 |
2/2✓ Branch 0 taken 254 times.
✓ Branch 1 taken 423 times.
|
677 | if(s_version >= 8) |
| 6132 | { | ||
| 6133 |
2/2✓ Branch 0 taken 6592 times.
✓ Branch 1 taken 423 times.
|
7015 | for(int32_t i=0; i<shops; i++) |
| 6134 | { | ||
| 6135 |
2/2✓ Branch 0 taken 19776 times.
✓ Branch 1 taken 6592 times.
|
26368 | for(int32_t j=0; j<3; j++) |
| 6136 | { | ||
| 6137 |
1/2✓ Branch 0 taken 19776 times.
✗ Branch 1 not taken.
|
19776 | if(!p_igetw(&temp_misc.shop[i].str[j],f)) |
| 6138 | ✗ | return qe_invalid; | |
| 6139 | 19776 | } | |
| 6140 | 6592 | } | |
| 6141 | 423 | } | |
| 6142 | |||
| 6143 | 677 | memset(&temp_misc.questmisc, 0, sizeof(int32_t)*32); | |
| 6144 | 677 | memset(&temp_misc.questmisc_strings, 0, sizeof(char)*4096); | |
| 6145 | 677 | memset(&temp_misc.zscript_last_compiled_version, 0, sizeof(int32_t)); | |
| 6146 | |||
| 6147 | //v9 includes quest misc[32] | ||
| 6148 |
2/2✓ Branch 0 taken 254 times.
✓ Branch 1 taken 423 times.
|
677 | if(s_version >= 9) |
| 6149 | { | ||
| 6150 |
2/2✓ Branch 0 taken 13536 times.
✓ Branch 1 taken 423 times.
|
13959 | for ( int32_t q = 0; q < 32; q++ ) |
| 6151 | { | ||
| 6152 |
1/2✓ Branch 0 taken 13536 times.
✗ Branch 1 not taken.
|
13536 | if(!p_igetl(&temp_misc.questmisc[q],f)) |
| 6153 | ✗ | return qe_invalid; | |
| 6154 | 13536 | } | |
| 6155 |
2/2✓ Branch 0 taken 13536 times.
✓ Branch 1 taken 423 times.
|
13959 | for ( int32_t q = 0; q < 32; q++ ) |
| 6156 | { | ||
| 6157 |
2/2✓ Branch 0 taken 1732608 times.
✓ Branch 1 taken 13536 times.
|
1746144 | for ( int32_t j = 0; j < 128; j++ ) |
| 6158 |
1/2✓ Branch 0 taken 1732608 times.
✗ Branch 1 not taken.
|
1732608 | if(!p_getc(&temp_misc.questmisc_strings[q][j],f)) |
| 6159 | ✗ | return qe_invalid; | |
| 6160 | 13536 | } | |
| 6161 | 423 | } | |
| 6162 | |||
| 6163 |
2/2✓ Branch 0 taken 423 times.
✓ Branch 1 taken 254 times.
|
677 | if(s_version >= 11 ) |
| 6164 | { | ||
| 6165 |
1/2✓ Branch 0 taken 423 times.
✗ Branch 1 not taken.
|
423 | if(!p_igetl(&temp_misc.zscript_last_compiled_version,f)) |
| 6166 | ✗ | return qe_invalid; | |
| 6167 | 423 | } | |
| 6168 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 254 times.
|
254 | else if(s_version < 11 ) |
| 6169 | { | ||
| 6170 | 254 | temp_misc.zscript_last_compiled_version = -1; | |
| 6171 | 254 | } | |
| 6172 | |||
| 6173 | 677 | FFCore.quest_format[vLastCompile] = temp_misc.zscript_last_compiled_version; | |
| 6174 | |||
| 6175 |
2/2✓ Branch 0 taken 423 times.
✓ Branch 1 taken 254 times.
|
677 | if(s_version >= 12) |
| 6176 | { | ||
| 6177 | byte spr; | ||
| 6178 |
2/2✓ Branch 0 taken 108288 times.
✓ Branch 1 taken 423 times.
|
108711 | for(int32_t q = 0; q < sprMAX; ++q) |
| 6179 | { | ||
| 6180 |
1/2✓ Branch 0 taken 108288 times.
✗ Branch 1 not taken.
|
108288 | if(!p_getc(&spr,f)) |
| 6181 | ✗ | return qe_invalid; | |
| 6182 | 108288 | temp_misc.sprites[q] = spr; | |
| 6183 | 108288 | } | |
| 6184 | 423 | } | |
| 6185 | else | ||
| 6186 | { | ||
| 6187 | 254 | memset(&(temp_misc.sprites), 0, sizeof(temp_misc.sprites)); | |
| 6188 | //temp_misc.sprites[sprFALL] = ; | ||
| 6189 | } | ||
| 6190 | |||
| 6191 |
2/2✓ Branch 0 taken 423 times.
✓ Branch 1 taken 254 times.
|
677 | if(s_version >= 13) |
| 6192 | { | ||
| 6193 |
2/2✓ Branch 0 taken 27072 times.
✓ Branch 1 taken 423 times.
|
27495 | for(size_t q = 0; q < 64; ++q) |
| 6194 | { | ||
| 6195 | 27072 | bottletype* bt = &(temp_misc.bottle_types[q]); | |
| 6196 |
1/2✓ Branch 0 taken 27072 times.
✗ Branch 1 not taken.
|
27072 | if (!p_getstr(bt->name, sizeof(bt->name)-1, f)) |
| 6197 | ✗ | return qe_invalid; | |
| 6198 |
2/2✓ Branch 0 taken 81216 times.
✓ Branch 1 taken 27072 times.
|
108288 | for(size_t j = 0; j < 3; ++j) |
| 6199 | { | ||
| 6200 |
1/2✓ Branch 0 taken 81216 times.
✗ Branch 1 not taken.
|
81216 | if (!p_getc(&(bt->counter[j]), f)) |
| 6201 | ✗ | return qe_invalid; | |
| 6202 |
1/2✓ Branch 0 taken 81216 times.
✗ Branch 1 not taken.
|
81216 | if (!p_igetw(&(bt->amount[j]), f)) |
| 6203 | ✗ | return qe_invalid; | |
| 6204 | 81216 | } | |
| 6205 |
1/2✓ Branch 0 taken 27072 times.
✗ Branch 1 not taken.
|
27072 | if (!p_getc(&(bt->flags), f)) |
| 6206 | ✗ | return qe_invalid; | |
| 6207 |
1/2✓ Branch 0 taken 27072 times.
✗ Branch 1 not taken.
|
27072 | if (!p_getc(&(bt->next_type), f)) |
| 6208 | ✗ | return qe_invalid; | |
| 6209 | 27072 | } | |
| 6210 |
2/2✓ Branch 0 taken 108288 times.
✓ Branch 1 taken 423 times.
|
108711 | for(size_t q = 0; q < 256; ++q) |
| 6211 | { | ||
| 6212 | 108288 | bottleshoptype* bst = &(temp_misc.bottle_shop_types[q]); | |
| 6213 |
1/2✓ Branch 0 taken 108288 times.
✗ Branch 1 not taken.
|
108288 | if (!pfread(bst->name, sizeof(bst->name)-1, f)) |
| 6214 | ✗ | return qe_invalid; | |
| 6215 |
2/2✓ Branch 0 taken 324864 times.
✓ Branch 1 taken 108288 times.
|
433152 | for(size_t j = 0; j < 3; ++j) |
| 6216 | { | ||
| 6217 |
1/2✓ Branch 0 taken 324864 times.
✗ Branch 1 not taken.
|
324864 | if (!p_getc(&(bst->fill[j]), f)) |
| 6218 | ✗ | return qe_invalid; | |
| 6219 |
1/2✓ Branch 0 taken 324864 times.
✗ Branch 1 not taken.
|
324864 | if (!p_igetw(&(bst->comb[j]), f)) |
| 6220 | ✗ | return qe_invalid; | |
| 6221 |
1/2✓ Branch 0 taken 324864 times.
✗ Branch 1 not taken.
|
324864 | if (!p_getc(&(bst->cset[j]), f)) |
| 6222 | ✗ | return qe_invalid; | |
| 6223 |
1/2✓ Branch 0 taken 324864 times.
✗ Branch 1 not taken.
|
324864 | if (!p_igetw(&(bst->price[j]), f)) |
| 6224 | ✗ | return qe_invalid; | |
| 6225 |
1/2✓ Branch 0 taken 324864 times.
✗ Branch 1 not taken.
|
324864 | if (!p_igetw(&(bst->str[j]), f)) |
| 6226 | ✗ | return qe_invalid; | |
| 6227 | 324864 | } | |
| 6228 | 108288 | } | |
| 6229 | 423 | } | |
| 6230 | else | ||
| 6231 | { | ||
| 6232 |
2/2✓ Branch 0 taken 16256 times.
✓ Branch 1 taken 254 times.
|
16510 | for(size_t q = 0; q < 64; ++q) |
| 6233 | 16256 | temp_misc.bottle_types[q].clear(); | |
| 6234 |
2/2✓ Branch 0 taken 65024 times.
✓ Branch 1 taken 254 times.
|
65278 | for(size_t q = 0; q < 256; ++q) |
| 6235 | 65024 | temp_misc.bottle_shop_types[q].clear(); | |
| 6236 | } | ||
| 6237 | |||
| 6238 |
2/2✓ Branch 0 taken 423 times.
✓ Branch 1 taken 254 times.
|
677 | if(s_version >= 14) |
| 6239 | { | ||
| 6240 | byte msfx; | ||
| 6241 |
2/2✓ Branch 0 taken 108288 times.
✓ Branch 1 taken 423 times.
|
108711 | for(int32_t q = 0; q < sfxMAX; ++q) |
| 6242 | { | ||
| 6243 |
1/2✓ Branch 0 taken 108288 times.
✗ Branch 1 not taken.
|
108288 | if(!p_getc(&msfx,f)) |
| 6244 | ✗ | return qe_invalid; | |
| 6245 | 108288 | temp_misc.miscsfx[q] = msfx; | |
| 6246 | 108288 | } | |
| 6247 | 423 | } | |
| 6248 | else | ||
| 6249 | { | ||
| 6250 | 254 | memset(&(temp_misc.miscsfx), 0, sizeof(temp_misc.miscsfx)); | |
| 6251 | 254 | temp_misc.miscsfx[sfxBUSHGRASS] = WAV_ZN1GRASSCUT; | |
| 6252 | 254 | temp_misc.miscsfx[sfxLOWHEART] = WAV_ER; | |
| 6253 | } | ||
| 6254 |
2/2✓ Branch 0 taken 423 times.
✓ Branch 1 taken 254 times.
|
677 | if(s_version < 15) |
| 6255 | { | ||
| 6256 | 254 | temp_misc.miscsfx[sfxHURTPLAYER] = WAV_OUCH; | |
| 6257 | 254 | temp_misc.miscsfx[sfxHAMMERPOUND] = WAV_ZN1HAMMERPOST; | |
| 6258 | 254 | temp_misc.miscsfx[sfxSUBSCR_ITEM_ASSIGN] = WAV_PLACE; | |
| 6259 | 254 | temp_misc.miscsfx[sfxSUBSCR_CURSOR_MOVE] = WAV_CHIME; | |
| 6260 | 254 | temp_misc.miscsfx[sfxREFILL] = WAV_MSG; | |
| 6261 | 254 | temp_misc.miscsfx[sfxDRAIN] = WAV_MSG; | |
| 6262 | 254 | } | |
| 6263 |
2/2✓ Branch 0 taken 405 times.
✓ Branch 1 taken 272 times.
|
677 | if(s_version < 16) |
| 6264 | { | ||
| 6265 | 272 | temp_misc.miscsfx[sfxTAP] = WAV_ZN1TAP; | |
| 6266 | 272 | temp_misc.miscsfx[sfxTAP_HOLLOW] = WAV_ZN1TAP2; | |
| 6267 | 272 | } | |
| 6268 | |||
| 6269 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 676 times.
|
677 | if (!should_skip) |
| 6270 | 676 | memcpy(Misc, &temp_misc, sizeof(temp_misc)); | |
| 6271 | |||
| 6272 | 677 | return 0; | |
| 6273 | 695 | } | |
| 6274 | |||
| 6275 | extern char *item_string[MAXITEMS]; | ||
| 6276 | extern const char *old_item_string[iLast]; | ||
| 6277 | extern char *weapon_string[MAXWPNS]; | ||
| 6278 | extern const char *old_weapon_string[wLast]; | ||
| 6279 | |||
| 6280 | 695 | int32_t readitems(PACKFILE *f, word version, word build) | |
| 6281 | { | ||
| 6282 |
2/2✓ Branch 0 taken 671 times.
✓ Branch 1 taken 24 times.
|
695 | bool should_skip = legacy_skip_flags && get_bit(legacy_skip_flags, skip_items); |
| 6283 | |||
| 6284 | byte padding; | ||
| 6285 | int32_t dummy; | ||
| 6286 | 695 | word items_to_read=MAXITEMS; | |
| 6287 | itemdata tempitem; | ||
| 6288 | 695 | word s_version=0, s_cversion=0; | |
| 6289 | word dummy_word; | ||
| 6290 | |||
| 6291 |
2/2✓ Branch 0 taken 689 times.
✓ Branch 1 taken 6 times.
|
695 | if(version < 0x186) |
| 6292 | { | ||
| 6293 | 6 | items_to_read=64; | |
| 6294 | 6 | } | |
| 6295 | |||
| 6296 |
2/2✓ Branch 0 taken 24 times.
✓ Branch 1 taken 671 times.
|
695 | if(version > 0x192) |
| 6297 | { | ||
| 6298 | 671 | items_to_read=0; | |
| 6299 | |||
| 6300 | //section version info | ||
| 6301 |
1/2✓ Branch 0 taken 671 times.
✗ Branch 1 not taken.
|
671 | if(!p_igetw(&s_version,f)) |
| 6302 | { | ||
| 6303 | ✗ | return qe_invalid; | |
| 6304 | } | ||
| 6305 | |||
| 6306 | 671 | FFCore.quest_format[vItems] = s_version; | |
| 6307 | |||
| 6308 | //al_trace("Items version %d\n", s_version); | ||
| 6309 |
1/2✓ Branch 0 taken 671 times.
✗ Branch 1 not taken.
|
671 | if(!p_igetw(&s_cversion,f)) |
| 6310 | { | ||
| 6311 | ✗ | return qe_invalid; | |
| 6312 | } | ||
| 6313 | |||
| 6314 | //section size | ||
| 6315 |
1/2✓ Branch 0 taken 671 times.
✗ Branch 1 not taken.
|
671 | if(!p_igetl(&dummy,f)) |
| 6316 | { | ||
| 6317 | ✗ | return qe_invalid; | |
| 6318 | } | ||
| 6319 | |||
| 6320 | //finally... section data | ||
| 6321 |
1/2✓ Branch 0 taken 671 times.
✗ Branch 1 not taken.
|
671 | if(!p_igetw(&items_to_read,f)) |
| 6322 | { | ||
| 6323 | ✗ | return qe_invalid; | |
| 6324 | } | ||
| 6325 | |||
| 6326 |
2/4✓ Branch 0 taken 671 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 671 times.
|
671 | if (!(items_to_read >= 0 && items_to_read <= MAXITEMS)) |
| 6327 | { | ||
| 6328 | ✗ | return qe_invalid; | |
| 6329 | } | ||
| 6330 | 671 | } | |
| 6331 | |||
| 6332 |
2/2✓ Branch 0 taken 612 times.
✓ Branch 1 taken 83 times.
|
695 | if(s_version>1) |
| 6333 | { | ||
| 6334 |
2/2✓ Branch 0 taken 156672 times.
✓ Branch 1 taken 612 times.
|
157284 | for(int32_t i=0; i<items_to_read; i++) |
| 6335 | { | ||
| 6336 | char tempname[64]; | ||
| 6337 | |||
| 6338 |
1/2✓ Branch 0 taken 156672 times.
✗ Branch 1 not taken.
|
156672 | if(!pfread(tempname, 64, f)) |
| 6339 | { | ||
| 6340 | ✗ | return qe_invalid; | |
| 6341 | } | ||
| 6342 | |||
| 6343 | 156672 | item_string[i][0] = '\0'; | |
| 6344 | 156672 | strncat(item_string[i], tempname, 64 - 1); | |
| 6345 | 156672 | } | |
| 6346 | 612 | } | |
| 6347 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 82 times.
|
83 | else if (!should_skip) |
| 6348 | { | ||
| 6349 |
2/2✓ Branch 0 taken 20992 times.
✓ Branch 1 taken 82 times.
|
21074 | for(int32_t i=0; i<MAXITEMS; i++) |
| 6350 | { | ||
| 6351 | 20992 | reset_itemname(i); | |
| 6352 | 20992 | } | |
| 6353 | 82 | } | |
| 6354 | |||
| 6355 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 694 times.
|
695 | if (!should_skip) |
| 6356 |
2/2✓ Branch 0 taken 177664 times.
✓ Branch 1 taken 694 times.
|
178358 | for(int32_t i=0; i<MAXITEMS; i++) |
| 6357 | { | ||
| 6358 | 177664 | itemdata& id = itemsbuf[i]; | |
| 6359 | 177664 | memset(&id, 0, sizeof(itemdata)); | |
| 6360 | 177664 | id.count=-1; | |
| 6361 | 177664 | id.playsound=WAV_SCALE; | |
| 6362 | 177664 | reset_itembuf(&id,i); | |
| 6363 | 178358 | } | |
| 6364 | |||
| 6365 |
2/2✓ Branch 0 taken 165794 times.
✓ Branch 1 taken 695 times.
|
166489 | for(int32_t i=0; i<items_to_read; i++) |
| 6366 | { | ||
| 6367 | 165794 | memset(&tempitem, 0, sizeof(itemdata)); | |
| 6368 | 165794 | reset_itembuf(&tempitem,i); | |
| 6369 | |||
| 6370 | |||
| 6371 |
2/2✓ Branch 0 taken 108288 times.
✓ Branch 1 taken 57506 times.
|
165794 | if ( s_version > 35 ) //expanded tiles |
| 6372 | { | ||
| 6373 |
1/2✓ Branch 0 taken 108288 times.
✗ Branch 1 not taken.
|
108288 | if(!p_igetl(&tempitem.tile,f)) |
| 6374 | { | ||
| 6375 | ✗ | return qe_invalid; | |
| 6376 | } | ||
| 6377 | 108288 | } | |
| 6378 | else | ||
| 6379 | { | ||
| 6380 |
1/2✓ Branch 0 taken 57506 times.
✗ Branch 1 not taken.
|
57506 | if(!p_igetw(&tempitem.tile,f)) |
| 6381 | { | ||
| 6382 | ✗ | return qe_invalid; | |
| 6383 | } | ||
| 6384 | } | ||
| 6385 | |||
| 6386 |
1/2✓ Branch 0 taken 165794 times.
✗ Branch 1 not taken.
|
165794 | if(!p_getc(&tempitem.misc_flags,f)) |
| 6387 | { | ||
| 6388 | ✗ | return qe_invalid; | |
| 6389 | } | ||
| 6390 | |||
| 6391 |
1/2✓ Branch 0 taken 165794 times.
✗ Branch 1 not taken.
|
165794 | if(!p_getc(&tempitem.csets,f)) |
| 6392 | { | ||
| 6393 | ✗ | return qe_invalid; | |
| 6394 | } | ||
| 6395 | |||
| 6396 |
1/2✓ Branch 0 taken 165794 times.
✗ Branch 1 not taken.
|
165794 | if(!p_getc(&tempitem.frames,f)) |
| 6397 | { | ||
| 6398 | ✗ | return qe_invalid; | |
| 6399 | } | ||
| 6400 | |||
| 6401 |
1/2✓ Branch 0 taken 165794 times.
✗ Branch 1 not taken.
|
165794 | if(!p_getc(&tempitem.speed,f)) |
| 6402 | { | ||
| 6403 | ✗ | return qe_invalid; | |
| 6404 | } | ||
| 6405 | |||
| 6406 |
1/2✓ Branch 0 taken 165794 times.
✗ Branch 1 not taken.
|
165794 | if(!p_getc(&tempitem.delay,f)) |
| 6407 | { | ||
| 6408 | ✗ | return qe_invalid; | |
| 6409 | } | ||
| 6410 | |||
| 6411 |
2/2✓ Branch 0 taken 160802 times.
✓ Branch 1 taken 4992 times.
|
165794 | if(version < 0x193) |
| 6412 | { | ||
| 6413 |
1/2✓ Branch 0 taken 4992 times.
✗ Branch 1 not taken.
|
4992 | if(!p_getc(&padding,f)) |
| 6414 | { | ||
| 6415 | ✗ | return qe_invalid; | |
| 6416 | } | ||
| 6417 | |||
| 6418 |
4/6✓ Branch 0 taken 1536 times.
✓ Branch 1 taken 3456 times.
✓ Branch 2 taken 1536 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1536 times.
✗ Branch 5 not taken.
|
4992 | if((version < 0x192)||((version == 0x192)&&(build<186))) |
| 6419 | { | ||
| 6420 |
2/2✓ Branch 0 taken 256 times.
✓ Branch 1 taken 4736 times.
|
4992 | if (should_skip) |
| 6421 | 256 | continue; | |
| 6422 | |||
| 6423 |
3/3✓ Branch 0 taken 4690 times.
✓ Branch 1 taken 23 times.
✓ Branch 2 taken 23 times.
|
4736 | switch(i) |
| 6424 | { | ||
| 6425 | case iShield: | ||
| 6426 | 23 | tempitem.ltm=get_qr(qr_BSZELDA)?-12:10; | |
| 6427 | 23 | break; | |
| 6428 | |||
| 6429 | case iMShield: | ||
| 6430 | 23 | tempitem.ltm=get_qr(qr_BSZELDA)?-6:-10; | |
| 6431 | 23 | break; | |
| 6432 | |||
| 6433 | default: | ||
| 6434 | 4690 | tempitem.ltm=0; | |
| 6435 | 4690 | break; | |
| 6436 | } | ||
| 6437 | |||
| 6438 | 4736 | tempitem.count=-1; | |
| 6439 | 4736 | tempitem.flags=tempitem.wpn=tempitem.wpn2=tempitem.wpn3=tempitem.wpn3=tempitem.pickup_hearts= | |
| 6440 | 4736 | tempitem.misc1=tempitem.misc2=tempitem.usesound=0; | |
| 6441 | 4736 | tempitem.family=0xFF; | |
| 6442 | 4736 | tempitem.playsound=WAV_SCALE; | |
| 6443 | 4736 | reset_itembuf(&tempitem,i); | |
| 6444 | |||
| 6445 | 4736 | memcpy(&itemsbuf[i], &tempitem, sizeof(itemdata)); | |
| 6446 | |||
| 6447 | 4736 | continue; | |
| 6448 | } | ||
| 6449 | ✗ | } | |
| 6450 | |||
| 6451 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 160802 times.
|
160802 | if(!p_igetl(&tempitem.ltm,f)) |
| 6452 | { | ||
| 6453 | ✗ | return qe_invalid; | |
| 6454 | } | ||
| 6455 | |||
| 6456 |
1/2✓ Branch 0 taken 160802 times.
✗ Branch 1 not taken.
|
160802 | if(version < 0x193) |
| 6457 | { | ||
| 6458 | ✗ | for(int32_t q=0; q<12; q++) | |
| 6459 | { | ||
| 6460 | ✗ | if(!p_getc(&padding,f)) | |
| 6461 | { | ||
| 6462 | ✗ | return qe_invalid; | |
| 6463 | } | ||
| 6464 | ✗ | } | |
| 6465 | ✗ | } | |
| 6466 | |||
| 6467 |
2/2✓ Branch 0 taken 156672 times.
✓ Branch 1 taken 4130 times.
|
160802 | if(s_version>1) |
| 6468 | { | ||
| 6469 |
2/2✓ Branch 0 taken 108288 times.
✓ Branch 1 taken 48384 times.
|
156672 | if ( s_version >= 31 ) |
| 6470 | { | ||
| 6471 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 108288 times.
|
108288 | if(!p_igetl(&tempitem.family,f)) |
| 6472 | { | ||
| 6473 | ✗ | return qe_invalid; | |
| 6474 | } | ||
| 6475 | 108288 | } | |
| 6476 | else | ||
| 6477 | { | ||
| 6478 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 48384 times.
|
48384 | if(!p_getc(&tempitem.family,f)) |
| 6479 | { | ||
| 6480 | ✗ | return qe_invalid; | |
| 6481 | } | ||
| 6482 | } | ||
| 6483 |
1/2✓ Branch 0 taken 156672 times.
✗ Branch 1 not taken.
|
156672 | if(s_version < 16) |
| 6484 | ✗ | if(tempitem.family == 0xFF) | |
| 6485 | ✗ | tempitem.family = itype_misc; | |
| 6486 | |||
| 6487 |
1/2✓ Branch 0 taken 156672 times.
✗ Branch 1 not taken.
|
156672 | if(!p_getc(&tempitem.fam_type,f)) |
| 6488 | { | ||
| 6489 | ✗ | return qe_invalid; | |
| 6490 | } | ||
| 6491 | |||
| 6492 |
1/2✓ Branch 0 taken 156672 times.
✗ Branch 1 not taken.
|
156672 | if(s_version>5) |
| 6493 | { | ||
| 6494 |
2/2✓ Branch 0 taken 108288 times.
✓ Branch 1 taken 48384 times.
|
156672 | if(s_version>=31) |
| 6495 | { | ||
| 6496 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 108288 times.
|
108288 | if(!p_igetl(&tempitem.power,f)) |
| 6497 | { | ||
| 6498 | ✗ | return qe_invalid; | |
| 6499 | } | ||
| 6500 | 108288 | } | |
| 6501 | else | ||
| 6502 | { | ||
| 6503 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 48384 times.
|
48384 | if(!p_getc(&tempitem.power,f)) |
| 6504 | { | ||
| 6505 | ✗ | return qe_invalid; | |
| 6506 | } | ||
| 6507 | } | ||
| 6508 | |||
| 6509 | //converted flags from 16b to 32b -Z | ||
| 6510 |
2/2✓ Branch 0 taken 48384 times.
✓ Branch 1 taken 108288 times.
|
156672 | if ( s_version < 41 ) |
| 6511 | { | ||
| 6512 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 48384 times.
|
48384 | if(!p_igetw(&tempitem.flags,f)) |
| 6513 | { | ||
| 6514 | ✗ | return qe_invalid; | |
| 6515 | } | ||
| 6516 | 48384 | } | |
| 6517 | else | ||
| 6518 | { | ||
| 6519 |
1/2✓ Branch 0 taken 108288 times.
✗ Branch 1 not taken.
|
108288 | if(!p_igetl(&tempitem.flags,f)) |
| 6520 | { | ||
| 6521 | ✗ | return qe_invalid; | |
| 6522 | } | ||
| 6523 | } | ||
| 6524 | 156672 | } | |
| 6525 | else | ||
| 6526 | { | ||
| 6527 | //tempitem.power = tempitem.fam_type; | ||
| 6528 | char tempchar; | ||
| 6529 | |||
| 6530 | ✗ | if(!p_getc(&tempchar,f)) | |
| 6531 | { | ||
| 6532 | ✗ | return qe_invalid; | |
| 6533 | } | ||
| 6534 | |||
| 6535 | ✗ | tempitem.flags |= (tempchar ? ITEM_GAMEDATA : 0); | |
| 6536 | } | ||
| 6537 | |||
| 6538 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 156672 times.
|
156672 | if(!p_igetw(&tempitem.script,f)) |
| 6539 | { | ||
| 6540 | ✗ | return qe_invalid; | |
| 6541 | } | ||
| 6542 | |||
| 6543 |
1/2✓ Branch 0 taken 156672 times.
✗ Branch 1 not taken.
|
156672 | if(s_version<=3) |
| 6544 | { | ||
| 6545 | ✗ | if(tempitem.script > NUMSCRIPTITEM) | |
| 6546 | { | ||
| 6547 | ✗ | tempitem.script = 0; | |
| 6548 | ✗ | } | |
| 6549 | ✗ | } | |
| 6550 | |||
| 6551 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 156672 times.
|
156672 | if(!p_getc(&tempitem.count,f)) |
| 6552 | { | ||
| 6553 | ✗ | return qe_invalid; | |
| 6554 | } | ||
| 6555 | |||
| 6556 |
1/2✓ Branch 0 taken 156672 times.
✗ Branch 1 not taken.
|
156672 | if(!p_igetw(&tempitem.amount,f)) |
| 6557 | { | ||
| 6558 | ✗ | return qe_invalid; | |
| 6559 | } | ||
| 6560 | |||
| 6561 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 156672 times.
|
156672 | if(!p_igetw(&tempitem.collect_script,f)) |
| 6562 | { | ||
| 6563 | ✗ | return qe_invalid; | |
| 6564 | } | ||
| 6565 | |||
| 6566 |
1/2✓ Branch 0 taken 156672 times.
✗ Branch 1 not taken.
|
156672 | if(s_version<=3) |
| 6567 | { | ||
| 6568 | ✗ | if(tempitem.collect_script > NUMSCRIPTITEM) | |
| 6569 | { | ||
| 6570 | ✗ | tempitem.collect_script = 0; | |
| 6571 | ✗ | } | |
| 6572 | ✗ | } | |
| 6573 | |||
| 6574 |
1/2✓ Branch 0 taken 156672 times.
✗ Branch 1 not taken.
|
156672 | if(!p_igetw(&tempitem.setmax,f)) |
| 6575 | { | ||
| 6576 | ✗ | return qe_invalid; | |
| 6577 | } | ||
| 6578 | |||
| 6579 |
1/2✓ Branch 0 taken 156672 times.
✗ Branch 1 not taken.
|
156672 | if(!p_igetw(&tempitem.max,f)) |
| 6580 | { | ||
| 6581 | ✗ | return qe_invalid; | |
| 6582 | } | ||
| 6583 | |||
| 6584 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 156672 times.
|
156672 | if(!p_getc(&tempitem.playsound,f)) |
| 6585 | { | ||
| 6586 | ✗ | return qe_invalid; | |
| 6587 | } | ||
| 6588 | |||
| 6589 |
2/2✓ Branch 0 taken 1253376 times.
✓ Branch 1 taken 156672 times.
|
1410048 | for(int32_t j=0; j<8; j++) |
| 6590 | { | ||
| 6591 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1253376 times.
|
1253376 | if(!p_igetl(&tempitem.initiald[j],f)) |
| 6592 | { | ||
| 6593 | ✗ | return qe_invalid; | |
| 6594 | } | ||
| 6595 | 1253376 | } | |
| 6596 | |||
| 6597 |
2/2✓ Branch 0 taken 313344 times.
✓ Branch 1 taken 156672 times.
|
470016 | for(int32_t j=0; j<2; j++) |
| 6598 | { | ||
| 6599 |
1/2✓ Branch 0 taken 313344 times.
✗ Branch 1 not taken.
|
313344 | if(!p_getc(&tempitem.initiala[j],f)) |
| 6600 | { | ||
| 6601 | ✗ | return qe_invalid; | |
| 6602 | } | ||
| 6603 | 313344 | } | |
| 6604 | |||
| 6605 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 156672 times.
|
156672 | if(s_version>4) |
| 6606 | { | ||
| 6607 |
1/2✓ Branch 0 taken 156672 times.
✗ Branch 1 not taken.
|
156672 | if(s_version>5) |
| 6608 | { | ||
| 6609 |
1/2✓ Branch 0 taken 156672 times.
✗ Branch 1 not taken.
|
156672 | if(!p_getc(&tempitem.wpn,f)) |
| 6610 | { | ||
| 6611 | ✗ | return qe_invalid; | |
| 6612 | } | ||
| 6613 | |||
| 6614 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 156672 times.
|
156672 | if(!p_getc(&tempitem.wpn2,f)) |
| 6615 | { | ||
| 6616 | ✗ | return qe_invalid; | |
| 6617 | } | ||
| 6618 | |||
| 6619 |
1/2✓ Branch 0 taken 156672 times.
✗ Branch 1 not taken.
|
156672 | if(!p_getc(&tempitem.wpn3,f)) |
| 6620 | { | ||
| 6621 | ✗ | return qe_invalid; | |
| 6622 | } | ||
| 6623 | |||
| 6624 |
1/2✓ Branch 0 taken 156672 times.
✗ Branch 1 not taken.
|
156672 | if(!p_getc(&tempitem.wpn4,f)) |
| 6625 | { | ||
| 6626 | ✗ | return qe_invalid; | |
| 6627 | } | ||
| 6628 | |||
| 6629 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 156672 times.
|
156672 | if(s_version>=15) |
| 6630 | { | ||
| 6631 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 156672 times.
|
156672 | if(!p_getc(&tempitem.wpn5,f)) |
| 6632 | { | ||
| 6633 | ✗ | return qe_invalid; | |
| 6634 | } | ||
| 6635 | |||
| 6636 |
1/2✓ Branch 0 taken 156672 times.
✗ Branch 1 not taken.
|
156672 | if(!p_getc(&tempitem.wpn6,f)) |
| 6637 | { | ||
| 6638 | ✗ | return qe_invalid; | |
| 6639 | } | ||
| 6640 | |||
| 6641 |
1/2✓ Branch 0 taken 156672 times.
✗ Branch 1 not taken.
|
156672 | if(!p_getc(&tempitem.wpn7,f)) |
| 6642 | { | ||
| 6643 | ✗ | return qe_invalid; | |
| 6644 | } | ||
| 6645 | |||
| 6646 |
1/2✓ Branch 0 taken 156672 times.
✗ Branch 1 not taken.
|
156672 | if(!p_getc(&tempitem.wpn8,f)) |
| 6647 | { | ||
| 6648 | ✗ | return qe_invalid; | |
| 6649 | } | ||
| 6650 | |||
| 6651 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 156672 times.
|
156672 | if(!p_getc(&tempitem.wpn9,f)) |
| 6652 | { | ||
| 6653 | ✗ | return qe_invalid; | |
| 6654 | } | ||
| 6655 | |||
| 6656 |
1/2✓ Branch 0 taken 156672 times.
✗ Branch 1 not taken.
|
156672 | if(!p_getc(&tempitem.wpn10,f)) |
| 6657 | { | ||
| 6658 | ✗ | return qe_invalid; | |
| 6659 | } | ||
| 6660 | 156672 | } | |
| 6661 | |||
| 6662 |
1/2✓ Branch 0 taken 156672 times.
✗ Branch 1 not taken.
|
156672 | if(!p_getc(&tempitem.pickup_hearts,f)) |
| 6663 | { | ||
| 6664 | ✗ | return qe_invalid; | |
| 6665 | } | ||
| 6666 | |||
| 6667 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 156672 times.
|
156672 | if(s_version<15) |
| 6668 | { | ||
| 6669 | ✗ | if(!p_igetw(&dummy_word,f)) | |
| 6670 | { | ||
| 6671 | ✗ | return qe_invalid; | |
| 6672 | } | ||
| 6673 | |||
| 6674 | ✗ | tempitem.misc1=dummy_word; | |
| 6675 | |||
| 6676 | ✗ | if(!p_igetw(&dummy_word,f)) | |
| 6677 | { | ||
| 6678 | ✗ | return qe_invalid; | |
| 6679 | } | ||
| 6680 | |||
| 6681 | ✗ | tempitem.misc2=dummy_word; | |
| 6682 | ✗ | } | |
| 6683 | else | ||
| 6684 | { | ||
| 6685 |
1/2✓ Branch 0 taken 156672 times.
✗ Branch 1 not taken.
|
156672 | if(!p_igetl(&tempitem.misc1,f)) |
| 6686 | { | ||
| 6687 | ✗ | return qe_invalid; | |
| 6688 | } | ||
| 6689 | |||
| 6690 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 156672 times.
|
156672 | if(!p_igetl(&tempitem.misc2,f)) |
| 6691 | { | ||
| 6692 | ✗ | return qe_invalid; | |
| 6693 | } | ||
| 6694 | |||
| 6695 | // Version 24: shICE -> shSCRIPT; previously, all shields could block script weapons | ||
| 6696 |
1/2✓ Branch 0 taken 156672 times.
✗ Branch 1 not taken.
|
156672 | if(s_version<24) |
| 6697 | { | ||
| 6698 | ✗ | if(tempitem.family==itype_shield) | |
| 6699 | { | ||
| 6700 | ✗ | tempitem.misc1|=shSCRIPT; | |
| 6701 | ✗ | } | |
| 6702 | ✗ | } | |
| 6703 | } | ||
| 6704 | |||
| 6705 |
2/2✓ Branch 0 taken 48384 times.
✓ Branch 1 taken 108288 times.
|
156672 | if(s_version < 53) |
| 6706 | { | ||
| 6707 | byte tempbyte; | ||
| 6708 |
1/2✓ Branch 0 taken 48384 times.
✗ Branch 1 not taken.
|
48384 | if(!p_getc(&tempbyte,f)) |
| 6709 | { | ||
| 6710 | ✗ | return qe_invalid; | |
| 6711 | } | ||
| 6712 | 48384 | tempitem.cost_amount[0] = tempbyte; | |
| 6713 | 48384 | } | |
| 6714 | else | ||
| 6715 | { | ||
| 6716 |
2/2✓ Branch 0 taken 216576 times.
✓ Branch 1 taken 108288 times.
|
324864 | for(auto q = 0; q < 2; ++q) |
| 6717 | { | ||
| 6718 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 216576 times.
|
216576 | if(!p_igetw(&tempitem.cost_amount[q],f)) |
| 6719 | { | ||
| 6720 | ✗ | return qe_invalid; | |
| 6721 | } | ||
| 6722 | 216576 | } | |
| 6723 | } | ||
| 6724 | 156672 | } | |
| 6725 | else | ||
| 6726 | { | ||
| 6727 | char tempchar; | ||
| 6728 | |||
| 6729 | ✗ | if(!p_getc(&tempchar,f)) | |
| 6730 | { | ||
| 6731 | ✗ | return qe_invalid; | |
| 6732 | } | ||
| 6733 | |||
| 6734 | ✗ | tempitem.flags |= (tempchar ? ITEM_EDIBLE : 0); | |
| 6735 | } | ||
| 6736 | |||
| 6737 | // June 2007: more misc. attributes | ||
| 6738 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 156672 times.
|
156672 | if(s_version>=12) |
| 6739 | { | ||
| 6740 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 156672 times.
|
156672 | if(s_version<15) |
| 6741 | { | ||
| 6742 | ✗ | if(!p_igetw(&dummy_word,f)) | |
| 6743 | { | ||
| 6744 | ✗ | return qe_invalid; | |
| 6745 | } | ||
| 6746 | |||
| 6747 | ✗ | tempitem.misc3=dummy_word; | |
| 6748 | |||
| 6749 | ✗ | if(!p_igetw(&dummy_word,f)) | |
| 6750 | { | ||
| 6751 | ✗ | return qe_invalid; | |
| 6752 | } | ||
| 6753 | |||
| 6754 | ✗ | tempitem.misc4=dummy_word; | |
| 6755 | ✗ | } | |
| 6756 | else | ||
| 6757 | { | ||
| 6758 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 156672 times.
|
156672 | if(!p_igetl(&tempitem.misc3,f)) |
| 6759 | { | ||
| 6760 | ✗ | return qe_invalid; | |
| 6761 | } | ||
| 6762 | |||
| 6763 |
1/2✓ Branch 0 taken 156672 times.
✗ Branch 1 not taken.
|
156672 | if(!p_igetl(&tempitem.misc4,f)) |
| 6764 | { | ||
| 6765 | ✗ | return qe_invalid; | |
| 6766 | } | ||
| 6767 | |||
| 6768 |
1/2✓ Branch 0 taken 156672 times.
✗ Branch 1 not taken.
|
156672 | if(!p_igetl(&tempitem.misc5,f)) |
| 6769 | { | ||
| 6770 | ✗ | return qe_invalid; | |
| 6771 | } | ||
| 6772 | |||
| 6773 |
1/2✓ Branch 0 taken 156672 times.
✗ Branch 1 not taken.
|
156672 | if(!p_igetl(&tempitem.misc6,f)) |
| 6774 | { | ||
| 6775 | ✗ | return qe_invalid; | |
| 6776 | } | ||
| 6777 | |||
| 6778 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 156672 times.
|
156672 | if(!p_igetl(&tempitem.misc7,f)) |
| 6779 | { | ||
| 6780 | ✗ | return qe_invalid; | |
| 6781 | } | ||
| 6782 | |||
| 6783 |
1/2✓ Branch 0 taken 156672 times.
✗ Branch 1 not taken.
|
156672 | if(!p_igetl(&tempitem.misc8,f)) |
| 6784 | { | ||
| 6785 | ✗ | return qe_invalid; | |
| 6786 | } | ||
| 6787 | |||
| 6788 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 156672 times.
|
156672 | if(!p_igetl(&tempitem.misc9,f)) |
| 6789 | { | ||
| 6790 | ✗ | return qe_invalid; | |
| 6791 | } | ||
| 6792 | |||
| 6793 |
1/2✓ Branch 0 taken 156672 times.
✗ Branch 1 not taken.
|
156672 | if(!p_igetl(&tempitem.misc10,f)) |
| 6794 | { | ||
| 6795 | ✗ | return qe_invalid; | |
| 6796 | } | ||
| 6797 | } | ||
| 6798 | |||
| 6799 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 156672 times.
|
156672 | if(!p_getc(&tempitem.usesound,f)) |
| 6800 | { | ||
| 6801 | ✗ | return qe_invalid; | |
| 6802 | } | ||
| 6803 | |||
| 6804 |
2/2✓ Branch 0 taken 108288 times.
✓ Branch 1 taken 48384 times.
|
156672 | if(s_version >= 49) |
| 6805 | { | ||
| 6806 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 108288 times.
|
108288 | if(!p_getc(&tempitem.usesound2,f)) |
| 6807 | { | ||
| 6808 | ✗ | return qe_invalid; | |
| 6809 | } | ||
| 6810 | 108288 | } | |
| 6811 | 48384 | else tempitem.usesound2 = 0; | |
| 6812 | |||
| 6813 |
3/4✓ Branch 0 taken 48384 times.
✓ Branch 1 taken 108288 times.
✓ Branch 2 taken 48384 times.
✗ Branch 3 not taken.
|
156672 | if(s_version < 50 && tempitem.family == itype_mirror) |
| 6814 | { | ||
| 6815 | //Split continue/dmap warp effect/sfx, port for old | ||
| 6816 | ✗ | tempitem.misc2 = tempitem.misc1; | |
| 6817 | ✗ | tempitem.usesound2 = tempitem.usesound; | |
| 6818 | ✗ | } | |
| 6819 | 156672 | } | |
| 6820 | 156672 | } | |
| 6821 | |||
| 6822 |
2/2✓ Branch 0 taken 48384 times.
✓ Branch 1 taken 108288 times.
|
156672 | if ( s_version >= 26 ) //! New itemdata vars for weapon editor. -Z |
| 6823 | { // temp.useweapon, temp.usedefence, temp.weaprange, temp.weap_pattern[ITEM_MOVEMENT_PATTERNS] | ||
| 6824 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 108288 times.
|
108288 | if(!p_getc(&tempitem.useweapon,f)) |
| 6825 | { | ||
| 6826 | ✗ | return qe_invalid; | |
| 6827 | } | ||
| 6828 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 108288 times.
|
108288 | if(!p_getc(&tempitem.usedefence,f)) |
| 6829 | { | ||
| 6830 | ✗ | return qe_invalid; | |
| 6831 | } | ||
| 6832 |
1/2✓ Branch 0 taken 108288 times.
✗ Branch 1 not taken.
|
108288 | if(!p_igetl(&tempitem.weaprange,f)) |
| 6833 | { | ||
| 6834 | ✗ | return qe_invalid; | |
| 6835 | } | ||
| 6836 |
1/2✓ Branch 0 taken 108288 times.
✗ Branch 1 not taken.
|
108288 | if(!p_igetl(&tempitem.weapduration,f)) |
| 6837 | { | ||
| 6838 | ✗ | return qe_invalid; | |
| 6839 | } | ||
| 6840 |
2/2✓ Branch 0 taken 1082880 times.
✓ Branch 1 taken 108288 times.
|
1191168 | for ( int32_t q = 0; q < ITEM_MOVEMENT_PATTERNS; q++ ) |
| 6841 | { | ||
| 6842 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1082880 times.
|
1082880 | if(!p_igetl(&tempitem.weap_pattern[q],f)) |
| 6843 | { | ||
| 6844 | ✗ | return qe_invalid; | |
| 6845 | } | ||
| 6846 | 1082880 | } | |
| 6847 | 108288 | } | |
| 6848 | |||
| 6849 |
2/2✓ Branch 0 taken 48384 times.
✓ Branch 1 taken 108288 times.
|
156672 | if ( s_version >= 27 ) //! New itemdata vars for weapon editor. -Z |
| 6850 | { // temp.useweapon, temp.usedefence, temp.weaprange, temp.weap_pattern[ITEM_MOVEMENT_PATTERNS] | ||
| 6851 |
1/2✓ Branch 0 taken 108288 times.
✗ Branch 1 not taken.
|
108288 | if(!p_igetl(&tempitem.duplicates,f)) |
| 6852 | { | ||
| 6853 | ✗ | return qe_invalid; | |
| 6854 | } | ||
| 6855 |
2/2✓ Branch 0 taken 866304 times.
✓ Branch 1 taken 108288 times.
|
974592 | for ( int32_t q = 0; q < INITIAL_D; q++ ) |
| 6856 | { | ||
| 6857 |
1/2✓ Branch 0 taken 866304 times.
✗ Branch 1 not taken.
|
866304 | if(!p_igetl(&tempitem.weap_initiald[q],f)) |
| 6858 | { | ||
| 6859 | ✗ | return qe_invalid; | |
| 6860 | } | ||
| 6861 | 866304 | } | |
| 6862 |
2/2✓ Branch 0 taken 216576 times.
✓ Branch 1 taken 108288 times.
|
324864 | for ( int32_t q = 0; q < INITIAL_A; q++ ) |
| 6863 | { | ||
| 6864 |
1/2✓ Branch 0 taken 216576 times.
✗ Branch 1 not taken.
|
216576 | if(!p_getc(&tempitem.weap_initiala[q],f)) |
| 6865 | { | ||
| 6866 | ✗ | return qe_invalid; | |
| 6867 | } | ||
| 6868 | 216576 | } | |
| 6869 | |||
| 6870 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 108288 times.
|
108288 | if(!p_getc(&tempitem.drawlayer,f)) |
| 6871 | { | ||
| 6872 | ✗ | return qe_invalid; | |
| 6873 | } | ||
| 6874 | |||
| 6875 | |||
| 6876 |
1/2✓ Branch 0 taken 108288 times.
✗ Branch 1 not taken.
|
108288 | if(!p_igetl(&tempitem.hxofs,f)) |
| 6877 | { | ||
| 6878 | ✗ | return qe_invalid; | |
| 6879 | } | ||
| 6880 |
1/2✓ Branch 0 taken 108288 times.
✗ Branch 1 not taken.
|
108288 | if(!p_igetl(&tempitem.hyofs,f)) |
| 6881 | { | ||
| 6882 | ✗ | return qe_invalid; | |
| 6883 | } | ||
| 6884 |
1/2✓ Branch 0 taken 108288 times.
✗ Branch 1 not taken.
|
108288 | if(!p_igetl(&tempitem.hxsz,f)) |
| 6885 | { | ||
| 6886 | ✗ | return qe_invalid; | |
| 6887 | } | ||
| 6888 |
1/2✓ Branch 0 taken 108288 times.
✗ Branch 1 not taken.
|
108288 | if(!p_igetl(&tempitem.hysz,f)) |
| 6889 | { | ||
| 6890 | ✗ | return qe_invalid; | |
| 6891 | } | ||
| 6892 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 108288 times.
|
108288 | if(!p_igetl(&tempitem.hzsz,f)) |
| 6893 | { | ||
| 6894 | ✗ | return qe_invalid; | |
| 6895 | } | ||
| 6896 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 108288 times.
|
108288 | if(!p_igetl(&tempitem.xofs,f)) |
| 6897 | { | ||
| 6898 | ✗ | return qe_invalid; | |
| 6899 | } | ||
| 6900 |
1/2✓ Branch 0 taken 108288 times.
✗ Branch 1 not taken.
|
108288 | if(!p_igetl(&tempitem.yofs,f)) |
| 6901 | { | ||
| 6902 | ✗ | return qe_invalid; | |
| 6903 | } | ||
| 6904 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 108288 times.
|
108288 | if(!p_igetl(&tempitem.weap_hxofs,f)) |
| 6905 | { | ||
| 6906 | ✗ | return qe_invalid; | |
| 6907 | } | ||
| 6908 |
1/2✓ Branch 0 taken 108288 times.
✗ Branch 1 not taken.
|
108288 | if(!p_igetl(&tempitem.weap_hyofs,f)) |
| 6909 | { | ||
| 6910 | ✗ | return qe_invalid; | |
| 6911 | } | ||
| 6912 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 108288 times.
|
108288 | if(!p_igetl(&tempitem.weap_hxsz,f)) |
| 6913 | { | ||
| 6914 | ✗ | return qe_invalid; | |
| 6915 | } | ||
| 6916 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 108288 times.
|
108288 | if(!p_igetl(&tempitem.weap_hysz,f)) |
| 6917 | { | ||
| 6918 | ✗ | return qe_invalid; | |
| 6919 | } | ||
| 6920 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 108288 times.
|
108288 | if(!p_igetl(&tempitem.weap_hzsz,f)) |
| 6921 | { | ||
| 6922 | ✗ | return qe_invalid; | |
| 6923 | } | ||
| 6924 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 108288 times.
|
108288 | if(!p_igetl(&tempitem.weap_xofs,f)) |
| 6925 | { | ||
| 6926 | ✗ | return qe_invalid; | |
| 6927 | } | ||
| 6928 |
1/2✓ Branch 0 taken 108288 times.
✗ Branch 1 not taken.
|
108288 | if(!p_igetl(&tempitem.weap_yofs,f)) |
| 6929 | { | ||
| 6930 | ✗ | return qe_invalid; | |
| 6931 | } | ||
| 6932 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 108288 times.
|
108288 | if(!p_igetw(&tempitem.weaponscript,f)) |
| 6933 | { | ||
| 6934 | ✗ | return qe_invalid; | |
| 6935 | } | ||
| 6936 |
1/2✓ Branch 0 taken 108288 times.
✗ Branch 1 not taken.
|
108288 | if(!p_igetl(&tempitem.wpnsprite,f)) |
| 6937 | { | ||
| 6938 | ✗ | return qe_invalid; | |
| 6939 | } | ||
| 6940 | 108288 | auto num_cost_tmr = (s_version > 52 ? 2 : 1); | |
| 6941 |
2/2✓ Branch 0 taken 216576 times.
✓ Branch 1 taken 108288 times.
|
324864 | for(auto q = 0; q < num_cost_tmr; ++q) |
| 6942 | { | ||
| 6943 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 216576 times.
|
216576 | if(!p_igetl(&tempitem.magiccosttimer[q],f)) |
| 6944 | { | ||
| 6945 | ✗ | return qe_invalid; | |
| 6946 | } | ||
| 6947 | 216576 | } | |
| 6948 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 108288 times.
|
108288 | for(auto q = num_cost_tmr; q < 2; ++q) |
| 6949 | ✗ | tempitem.magiccosttimer[q] = 0; | |
| 6950 | 108288 | } | |
| 6951 |
2/2✓ Branch 0 taken 48384 times.
✓ Branch 1 taken 108288 times.
|
156672 | if ( s_version >= 28 ) //! New itemdata vars for weapon editor. -Z |
| 6952 | { | ||
| 6953 | //Item Size FLags, TileWidth, TileHeight | ||
| 6954 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 108288 times.
|
108288 | if(!p_igetl(&tempitem.overrideFLAGS,f)) |
| 6955 | { | ||
| 6956 | ✗ | return qe_invalid; | |
| 6957 | } | ||
| 6958 |
1/2✓ Branch 0 taken 108288 times.
✗ Branch 1 not taken.
|
108288 | if(!p_igetl(&tempitem.tilew,f)) |
| 6959 | { | ||
| 6960 | ✗ | return qe_invalid; | |
| 6961 | } | ||
| 6962 |
1/2✓ Branch 0 taken 108288 times.
✗ Branch 1 not taken.
|
108288 | if(!p_igetl(&tempitem.tileh,f)) |
| 6963 | { | ||
| 6964 | ✗ | return qe_invalid; | |
| 6965 | } | ||
| 6966 | 108288 | } | |
| 6967 |
2/2✓ Branch 0 taken 48384 times.
✓ Branch 1 taken 108288 times.
|
156672 | if ( s_version >= 29 ) //! More new vars. |
| 6968 | { | ||
| 6969 | //Item Size FLags, TileWidth, TileHeight | ||
| 6970 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 108288 times.
|
108288 | if(!p_igetl(&tempitem.weapoverrideFLAGS,f)) |
| 6971 | { | ||
| 6972 | ✗ | return qe_invalid; | |
| 6973 | } | ||
| 6974 |
1/2✓ Branch 0 taken 108288 times.
✗ Branch 1 not taken.
|
108288 | if(!p_igetl(&tempitem.weap_tilew,f)) |
| 6975 | { | ||
| 6976 | ✗ | return qe_invalid; | |
| 6977 | } | ||
| 6978 |
1/2✓ Branch 0 taken 108288 times.
✗ Branch 1 not taken.
|
108288 | if(!p_igetl(&tempitem.weap_tileh,f)) |
| 6979 | { | ||
| 6980 | ✗ | return qe_invalid; | |
| 6981 | } | ||
| 6982 | 108288 | } | |
| 6983 |
2/2✓ Branch 0 taken 48384 times.
✓ Branch 1 taken 108288 times.
|
156672 | if ( s_version >= 30 ) //! More new vars. |
| 6984 | { | ||
| 6985 | //Pickup Type | ||
| 6986 |
1/2✓ Branch 0 taken 108288 times.
✗ Branch 1 not taken.
|
108288 | if(!p_igetl(&tempitem.pickup,f)) |
| 6987 | { | ||
| 6988 | ✗ | return qe_invalid; | |
| 6989 | } | ||
| 6990 | 108288 | } | |
| 6991 |
2/2✓ Branch 0 taken 48384 times.
✓ Branch 1 taken 108288 times.
|
156672 | if ( s_version >= 32 ) //! More new vars. |
| 6992 | { | ||
| 6993 | //Pickup Type | ||
| 6994 |
1/2✓ Branch 0 taken 108288 times.
✗ Branch 1 not taken.
|
108288 | if(!p_igetw(&tempitem.pstring,f)) |
| 6995 | { | ||
| 6996 | ✗ | return qe_invalid; | |
| 6997 | } | ||
| 6998 | 108288 | } | |
| 6999 |
2/2✓ Branch 0 taken 48384 times.
✓ Branch 1 taken 108288 times.
|
156672 | if ( s_version >= 33 ) //! More new vars. |
| 7000 | { | ||
| 7001 | //Pickup Type | ||
| 7002 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 108288 times.
|
108288 | if(!p_igetw(&tempitem.pickup_string_flags,f)) |
| 7003 | { | ||
| 7004 | ✗ | return qe_invalid; | |
| 7005 | } | ||
| 7006 | 108288 | } | |
| 7007 |
2/2✓ Branch 0 taken 48384 times.
✓ Branch 1 taken 108288 times.
|
156672 | if ( s_version >= 34 ) //! cost counter |
| 7008 | { | ||
| 7009 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 108288 times.
|
108288 | if(s_version < 53) |
| 7010 | { | ||
| 7011 | ✗ | if(!p_getc(&tempitem.cost_counter[0],f)) | |
| 7012 | { | ||
| 7013 | ✗ | return qe_invalid; | |
| 7014 | } | ||
| 7015 | ✗ | } | |
| 7016 | else | ||
| 7017 | { | ||
| 7018 |
2/2✓ Branch 0 taken 216576 times.
✓ Branch 1 taken 108288 times.
|
324864 | for(auto q = 0; q < 2; ++q) |
| 7019 | { | ||
| 7020 |
1/2✓ Branch 0 taken 216576 times.
✗ Branch 1 not taken.
|
216576 | if(!p_getc(&tempitem.cost_counter[q],f)) |
| 7021 | { | ||
| 7022 | ✗ | return qe_invalid; | |
| 7023 | } | ||
| 7024 | 216576 | } | |
| 7025 | } | ||
| 7026 | 108288 | } | |
| 7027 |
2/2✓ Branch 0 taken 48384 times.
✓ Branch 1 taken 108288 times.
|
156672 | if ( s_version >= 44 ) //! sprite scripts |
| 7028 | { | ||
| 7029 |
2/2✓ Branch 0 taken 866304 times.
✓ Branch 1 taken 108288 times.
|
974592 | for ( int32_t q = 0; q < 8; q++ ) |
| 7030 | { | ||
| 7031 |
2/2✓ Branch 0 taken 56309760 times.
✓ Branch 1 taken 866304 times.
|
57176064 | for ( int32_t w = 0; w < 65; w++ ) |
| 7032 | { | ||
| 7033 |
1/2✓ Branch 0 taken 56309760 times.
✗ Branch 1 not taken.
|
56309760 | if(!p_getc(&(tempitem.initD_label[q][w]),f)) |
| 7034 | { | ||
| 7035 | ✗ | return qe_invalid; | |
| 7036 | } | ||
| 7037 | 56309760 | } | |
| 7038 |
2/2✓ Branch 0 taken 56309760 times.
✓ Branch 1 taken 866304 times.
|
57176064 | for ( int32_t w = 0; w < 65; w++ ) |
| 7039 | { | ||
| 7040 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 56309760 times.
|
56309760 | if(!p_getc(&(tempitem.weapon_initD_label[q][w]),f)) |
| 7041 | { | ||
| 7042 | ✗ | return qe_invalid; | |
| 7043 | } | ||
| 7044 | 56309760 | } | |
| 7045 |
2/2✓ Branch 0 taken 56309760 times.
✓ Branch 1 taken 866304 times.
|
57176064 | for ( int32_t w = 0; w < 65; w++ ) |
| 7046 | { | ||
| 7047 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 56309760 times.
|
56309760 | if(!p_getc(&(tempitem.sprite_initD_label[q][w]),f)) |
| 7048 | { | ||
| 7049 | ✗ | return qe_invalid; | |
| 7050 | } | ||
| 7051 | 56309760 | } | |
| 7052 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 866304 times.
|
866304 | if(!p_igetl(&(tempitem.sprite_initiald[q]),f)) |
| 7053 | { | ||
| 7054 | ✗ | return qe_invalid; | |
| 7055 | } | ||
| 7056 | |||
| 7057 | 866304 | } | |
| 7058 |
2/2✓ Branch 0 taken 216576 times.
✓ Branch 1 taken 108288 times.
|
324864 | for ( int32_t q = 0; q < 2; q++ ) |
| 7059 | { | ||
| 7060 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 216576 times.
|
216576 | if(!p_getc(&(tempitem.sprite_initiala[q]),f)) |
| 7061 | { | ||
| 7062 | ✗ | return qe_invalid; | |
| 7063 | } | ||
| 7064 | 216576 | } | |
| 7065 | //Pickup Type | ||
| 7066 |
1/2✓ Branch 0 taken 108288 times.
✗ Branch 1 not taken.
|
108288 | if(!p_igetw(&tempitem.sprite_script,f)) |
| 7067 | { | ||
| 7068 | ✗ | return qe_invalid; | |
| 7069 | } | ||
| 7070 | 108288 | } | |
| 7071 |
2/2✓ Branch 0 taken 48384 times.
✓ Branch 1 taken 108288 times.
|
156672 | if ( s_version >= 48 ) //! pickup flags |
| 7072 | { | ||
| 7073 |
1/2✓ Branch 0 taken 108288 times.
✗ Branch 1 not taken.
|
108288 | if(!p_getc(&(tempitem.pickupflag),f)) |
| 7074 | { | ||
| 7075 | ✗ | return qe_invalid; | |
| 7076 | } | ||
| 7077 | 108288 | } | |
| 7078 |
2/2✓ Branch 0 taken 51712 times.
✓ Branch 1 taken 104960 times.
|
156672 | if ( s_version >= 57 ) |
| 7079 | { | ||
| 7080 | 104960 | std::string str; | |
| 7081 |
2/4✗ Branch 0 not taken.
✓ Branch 1 taken 104960 times.
✓ Branch 2 taken 104960 times.
✗ Branch 3 not taken.
|
104960 | if(!p_getcstr(&str,f)) |
| 7082 | ✗ | return qe_invalid; | |
| 7083 | 104960 | strncpy(tempitem.display_name,str.c_str(),255); | |
| 7084 |
1/3✓ Branch 0 taken 104960 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
|
104960 | } |
| 7085 | 156672 | } | |
| 7086 | else | ||
| 7087 | { | ||
| 7088 | 4130 | tempitem.count=-1; | |
| 7089 | 4130 | tempitem.family=itype_misc; | |
| 7090 | 4130 | tempitem.flags=tempitem.wpn=tempitem.wpn2=tempitem.wpn3=tempitem.wpn3=tempitem.pickup_hearts=tempitem.misc1=tempitem.misc2=tempitem.usesound=0; | |
| 7091 | 4130 | tempitem.playsound=WAV_SCALE; | |
| 7092 | 4130 | reset_itembuf(&tempitem,i); | |
| 7093 | } | ||
| 7094 | |||
| 7095 |
2/2✓ Branch 0 taken 57122 times.
✓ Branch 1 taken 103680 times.
|
160802 | if(s_version >= 58) |
| 7096 | { | ||
| 7097 |
2/2✓ Branch 0 taken 518400 times.
✓ Branch 1 taken 103680 times.
|
622080 | for(int q = 0; q < BURNSPR_MAX; ++q) |
| 7098 | { | ||
| 7099 |
1/2✓ Branch 0 taken 518400 times.
✗ Branch 1 not taken.
|
518400 | if(!p_getc(&tempitem.burnsprs[q],f)) |
| 7100 | ✗ | return qe_invalid; | |
| 7101 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 518400 times.
|
518400 | if(s_version >= 59) |
| 7102 |
1/2✓ Branch 0 taken 518400 times.
✗ Branch 1 not taken.
|
518400 | if(!p_getc(&tempitem.light_rads[q],f)) |
| 7103 | ✗ | return qe_invalid; | |
| 7104 | 518400 | } | |
| 7105 | 103680 | } | |
| 7106 | |||
| 7107 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 160802 times.
|
160802 | if (!should_skip) |
| 7108 | { | ||
| 7109 |
1/2✓ Branch 0 taken 160802 times.
✗ Branch 1 not taken.
|
160802 | if(loading_tileset_flags & TILESET_CLEARSCRIPTS) |
| 7110 | { | ||
| 7111 | ✗ | tempitem.script = 0; | |
| 7112 | ✗ | tempitem.weaponscript = 0; | |
| 7113 | ✗ | for(int q = 0; q < 8; ++q) | |
| 7114 | { | ||
| 7115 | ✗ | tempitem.initiald[q] = 0; | |
| 7116 | ✗ | tempitem.weap_initiald[q] = 0; | |
| 7117 | ✗ | } | |
| 7118 | ✗ | } | |
| 7119 | 160802 | memcpy(&itemsbuf[i], &tempitem, sizeof(itemdata)); | |
| 7120 | 160802 | } | |
| 7121 | 160802 | } | |
| 7122 | |||
| 7123 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 694 times.
|
695 | if (should_skip) |
| 7124 | 1 | return 0; | |
| 7125 | |||
| 7126 | ////////////////////////////////////////////////////// | ||
| 7127 | // Now do any updates because of new item additions | ||
| 7128 | // (These can't be done above because items_to_read | ||
| 7129 | // might be too low.) | ||
| 7130 | ////////////////////////////////////////////////////// | ||
| 7131 |
2/2✓ Branch 0 taken 177664 times.
✓ Branch 1 taken 694 times.
|
178358 | for(int32_t i=0; i<MAXITEMS; i++) |
| 7132 | { | ||
| 7133 | 177664 | memcpy(&tempitem, &itemsbuf[i], sizeof(itemdata)); | |
| 7134 | |||
| 7135 | //Account for older quests that didn't have an actual item for the used letter | ||
| 7136 |
4/4✓ Branch 0 taken 20992 times.
✓ Branch 1 taken 156672 times.
✓ Branch 2 taken 20910 times.
✓ Branch 3 taken 82 times.
|
177664 | if(s_version < 2 && i==iLetterUsed) |
| 7137 | { | ||
| 7138 | 82 | reset_itembuf(&tempitem, iLetterUsed); | |
| 7139 | 82 | strcpy(item_string[i],old_item_string[i]); | |
| 7140 | 82 | tempitem.tile = itemsbuf[iLetter].tile; | |
| 7141 | 82 | tempitem.csets = itemsbuf[iLetter].csets; | |
| 7142 | 82 | tempitem.misc_flags = itemsbuf[iLetter].misc_flags; | |
| 7143 | 82 | tempitem.frames = itemsbuf[iLetter].frames; | |
| 7144 | 82 | tempitem.speed = itemsbuf[iLetter].speed; | |
| 7145 | 82 | tempitem.ltm = itemsbuf[iLetter].ltm; | |
| 7146 | 82 | } | |
| 7147 | |||
| 7148 |
2/2✓ Branch 0 taken 156672 times.
✓ Branch 1 taken 20992 times.
|
177664 | if(s_version < 3) |
| 7149 | { | ||
| 7150 |
3/3✓ Branch 0 taken 1804 times.
✓ Branch 1 taken 19106 times.
✓ Branch 2 taken 82 times.
|
20992 | switch(i) |
| 7151 | { | ||
| 7152 | case iRocsFeather: | ||
| 7153 | case iHoverBoots: | ||
| 7154 | case iSpinScroll: | ||
| 7155 | case iL2SpinScroll: | ||
| 7156 | case iCrossScroll: | ||
| 7157 | case iQuakeScroll: | ||
| 7158 | case iL2QuakeScroll: | ||
| 7159 | case iWhispRing: | ||
| 7160 | case iL2WhispRing: | ||
| 7161 | case iChargeRing: | ||
| 7162 | case iL2ChargeRing: | ||
| 7163 | case iPerilScroll: | ||
| 7164 | case iWalletL3: | ||
| 7165 | case iQuiverL4: | ||
| 7166 | case iBombBagL4: | ||
| 7167 | case iBracelet: | ||
| 7168 | case iL2Bracelet: | ||
| 7169 | case iOldGlove: | ||
| 7170 | case iL2Ladder: | ||
| 7171 | case iWealthMedal: | ||
| 7172 | case iL2WealthMedal: | ||
| 7173 | case iL3WealthMedal: | ||
| 7174 | 1804 | reset_itembuf(&tempitem, i); | |
| 7175 | 1804 | strcpy(item_string[i],old_item_string[i]); | |
| 7176 | 1804 | break; | |
| 7177 | |||
| 7178 | case iSShield: | ||
| 7179 | 82 | reset_itembuf(&tempitem, i); | |
| 7180 | 82 | strcpy(item_string[i],old_item_string[i]); | |
| 7181 | 82 | strcpy(item_string[iShield],old_item_string[iShield]); | |
| 7182 | 82 | strcpy(item_string[iMShield],old_item_string[iMShield]); | |
| 7183 | 82 | break; | |
| 7184 | } | ||
| 7185 | 20992 | } | |
| 7186 | |||
| 7187 |
2/2✓ Branch 0 taken 156672 times.
✓ Branch 1 taken 20992 times.
|
177664 | if(s_version < 5) |
| 7188 | { | ||
| 7189 |
2/2✓ Branch 0 taken 574 times.
✓ Branch 1 taken 20418 times.
|
20992 | switch(i) |
| 7190 | { | ||
| 7191 | case iHeartRing: | ||
| 7192 | case iL2HeartRing: | ||
| 7193 | case iL3HeartRing: | ||
| 7194 | case iMagicRing: | ||
| 7195 | case iL2MagicRing: | ||
| 7196 | case iL3MagicRing: | ||
| 7197 | case iL4MagicRing: | ||
| 7198 | 574 | reset_itembuf(&tempitem, i); | |
| 7199 | 574 | strcpy(item_string[i],old_item_string[i]); | |
| 7200 | 574 | break; | |
| 7201 | } | ||
| 7202 | 20992 | } | |
| 7203 | |||
| 7204 |
2/2✓ Branch 0 taken 156672 times.
✓ Branch 1 taken 20992 times.
|
177664 | if(s_version < 6) // April 2007: Advanced item editing capabilities. |
| 7205 | { | ||
| 7206 |
4/4✓ Branch 0 taken 20910 times.
✓ Branch 1 taken 82 times.
✓ Branch 2 taken 82 times.
✓ Branch 3 taken 20828 times.
|
20992 | if(i!=iBPotion && i!=iRPotion) |
| 7207 | 20828 | tempitem.flags |= get_bit(deprecated_rules,32) ? ITEM_KEEPOLD : 0; | |
| 7208 | |||
| 7209 |
43/43✓ Branch 0 taken 82 times.
✓ Branch 1 taken 82 times.
✓ Branch 2 taken 82 times.
✓ Branch 3 taken 82 times.
✓ Branch 4 taken 82 times.
✓ Branch 5 taken 82 times.
✓ Branch 6 taken 82 times.
✓ Branch 7 taken 328 times.
✓ Branch 8 taken 17302 times.
✓ Branch 9 taken 82 times.
✓ Branch 10 taken 82 times.
✓ Branch 11 taken 82 times.
✓ Branch 12 taken 82 times.
✓ Branch 13 taken 82 times.
✓ Branch 14 taken 82 times.
✓ Branch 15 taken 82 times.
✓ Branch 16 taken 82 times.
✓ Branch 17 taken 82 times.
✓ Branch 18 taken 82 times.
✓ Branch 19 taken 82 times.
✓ Branch 20 taken 82 times.
✓ Branch 21 taken 82 times.
✓ Branch 22 taken 82 times.
✓ Branch 23 taken 82 times.
✓ Branch 24 taken 82 times.
✓ Branch 25 taken 82 times.
✓ Branch 26 taken 82 times.
✓ Branch 27 taken 82 times.
✓ Branch 28 taken 82 times.
✓ Branch 29 taken 82 times.
✓ Branch 30 taken 82 times.
✓ Branch 31 taken 82 times.
✓ Branch 32 taken 82 times.
✓ Branch 33 taken 82 times.
✓ Branch 34 taken 82 times.
✓ Branch 35 taken 82 times.
✓ Branch 36 taken 82 times.
✓ Branch 37 taken 82 times.
✓ Branch 38 taken 82 times.
✓ Branch 39 taken 82 times.
✓ Branch 40 taken 82 times.
✓ Branch 41 taken 82 times.
✓ Branch 42 taken 82 times.
|
20992 | switch(i) |
| 7210 | { | ||
| 7211 | case iTriforce: | ||
| 7212 | 82 | tempitem.fam_type=1; | |
| 7213 | 82 | break; | |
| 7214 | |||
| 7215 | case iBigTri: | ||
| 7216 | 82 | tempitem.fam_type=0; | |
| 7217 | 82 | break; | |
| 7218 | |||
| 7219 | case iBombs: | ||
| 7220 | 82 | tempitem.fam_type=i_bomb; | |
| 7221 | 82 | tempitem.power=4; | |
| 7222 | 82 | tempitem.wpn=wBOMB; | |
| 7223 | 82 | tempitem.wpn2=wBOOM; | |
| 7224 | 82 | tempitem.misc1 = 50; | |
| 7225 | |||
| 7226 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 82 times.
|
82 | if(get_bit(deprecated_rules,qr_SLOWBOMBFUSES_DEP)) tempitem.misc1 = 200; |
| 7227 | |||
| 7228 | 82 | break; | |
| 7229 | |||
| 7230 | case iSBomb: | ||
| 7231 | 82 | tempitem.fam_type=i_sbomb; | |
| 7232 | 82 | tempitem.power=16; | |
| 7233 | 82 | tempitem.wpn=wSBOMB; | |
| 7234 | 82 | tempitem.wpn2=wSBOOM; | |
| 7235 | 82 | tempitem.misc1 = 50; | |
| 7236 | |||
| 7237 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 82 times.
|
82 | if(get_bit(deprecated_rules,qr_SLOWBOMBFUSES_DEP)) tempitem.misc1 = 400; |
| 7238 | |||
| 7239 | 82 | break; | |
| 7240 | |||
| 7241 | case iBook: | ||
| 7242 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 82 times.
|
82 | if(get_bit(deprecated_rules, qr_FIREMAGICSPRITE_DEP)) |
| 7243 | ✗ | tempitem.wpn = wFIREMAGIC; | |
| 7244 | |||
| 7245 | 82 | break; | |
| 7246 | |||
| 7247 | case iSArrow: | ||
| 7248 | 82 | tempitem.wpn2 = get_bit(deprecated_rules,27) ? wSSPARKLE : 0; //qr_SASPARKLES | |
| 7249 | 82 | tempitem.power=4; | |
| 7250 | 82 | tempitem.flags|=ITEM_GAMEDATA; | |
| 7251 | 82 | tempitem.wpn=wSARROW; | |
| 7252 | 82 | break; | |
| 7253 | |||
| 7254 | case iGArrow: | ||
| 7255 | 82 | tempitem.wpn2 = get_bit(deprecated_rules,28) ? wGSPARKLE : 0; //qr_GASPARKLES | |
| 7256 | 82 | tempitem.power=8; | |
| 7257 | 82 | tempitem.flags|=(ITEM_GAMEDATA|ITEM_FLAG1); | |
| 7258 | 82 | tempitem.wpn=wGARROW; | |
| 7259 | 82 | break; | |
| 7260 | |||
| 7261 | case iBrang: | ||
| 7262 | 82 | tempitem.power=0; | |
| 7263 | 82 | tempitem.wpn=wBRANG; | |
| 7264 | 82 | tempitem.misc1=36; | |
| 7265 | 82 | break; | |
| 7266 | |||
| 7267 | case iMBrang: | ||
| 7268 | 82 | tempitem.wpn2 = get_bit(deprecated_rules,29) ? wMSPARKLE : 0; //qr_MBSPARKLES | |
| 7269 | 82 | tempitem.power=0; | |
| 7270 | 82 | tempitem.wpn=wMBRANG; | |
| 7271 | 82 | break; | |
| 7272 | |||
| 7273 | case iFBrang: | ||
| 7274 | 82 | tempitem.wpn3 = get_bit(deprecated_rules,30) ? wFSPARKLE : 0; //qr_FBSPARKLES | |
| 7275 | 82 | tempitem.power=2; | |
| 7276 | 82 | tempitem.wpn=wFBRANG; | |
| 7277 | 82 | break; | |
| 7278 | |||
| 7279 | case iBoots: | ||
| 7280 | 82 | tempitem.cost_amount[0] = get_bit(deprecated_rules,qr_MAGICBOOTS_DEP) ? 1 : 0; | |
| 7281 | 82 | tempitem.power=7; | |
| 7282 | 82 | break; | |
| 7283 | |||
| 7284 | case iWand: | ||
| 7285 | 82 | tempitem.cost_amount[0] = get_bit(deprecated_rules,qr_MAGICWAND_DEP) ? 8 : 0; | |
| 7286 | 82 | tempitem.power=2; | |
| 7287 | 82 | tempitem.wpn=wWAND; | |
| 7288 | 82 | tempitem.wpn3=wMAGIC; | |
| 7289 | 82 | break; | |
| 7290 | |||
| 7291 | case iBCandle: | ||
| 7292 | 82 | tempitem.cost_amount[0] = get_bit(deprecated_rules,qr_MAGICCANDLE_DEP) ? 4 : 0; | |
| 7293 | 82 | tempitem.power=1; | |
| 7294 | 82 | tempitem.flags|=(ITEM_GAMEDATA|ITEM_FLAG1); | |
| 7295 | 82 | tempitem.wpn3=wFIRE; | |
| 7296 | 82 | break; | |
| 7297 | |||
| 7298 | case iRCandle: | ||
| 7299 | 82 | tempitem.cost_amount[0] = get_bit(deprecated_rules,qr_MAGICCANDLE_DEP) ? 4 : 0; | |
| 7300 | 82 | tempitem.power=1; | |
| 7301 | 82 | tempitem.wpn3=wFIRE; | |
| 7302 | 82 | break; | |
| 7303 | |||
| 7304 | case iSword: | ||
| 7305 | 82 | tempitem.power=1; | |
| 7306 | 82 | tempitem.flags|= ITEM_FLAG4 |ITEM_FLAG2; | |
| 7307 | 82 | tempitem.wpn=tempitem.wpn3=wSWORD; | |
| 7308 | 82 | tempitem.wpn2=wSWORDSLASH; | |
| 7309 | 82 | break; | |
| 7310 | |||
| 7311 | case iWSword: | ||
| 7312 | 82 | tempitem.power=2; | |
| 7313 | 82 | tempitem.flags|= ITEM_FLAG4 |ITEM_FLAG2; | |
| 7314 | 82 | tempitem.wpn=tempitem.wpn3=wWSWORD; | |
| 7315 | 82 | tempitem.wpn2=wWSWORDSLASH; | |
| 7316 | 82 | break; | |
| 7317 | |||
| 7318 | case iMSword: | ||
| 7319 | 82 | tempitem.power=4; | |
| 7320 | 82 | tempitem.flags|= ITEM_FLAG4 |ITEM_FLAG2; | |
| 7321 | 82 | tempitem.wpn=tempitem.wpn3=wMSWORD; | |
| 7322 | 82 | tempitem.wpn2=wMSWORDSLASH; | |
| 7323 | 82 | break; | |
| 7324 | |||
| 7325 | case iXSword: | ||
| 7326 | 82 | tempitem.power=8; | |
| 7327 | 82 | tempitem.flags|= ITEM_FLAG4 |ITEM_FLAG2; | |
| 7328 | 82 | tempitem.wpn=tempitem.wpn3=wXSWORD; | |
| 7329 | 82 | tempitem.wpn2=wXSWORDSLASH; | |
| 7330 | 82 | break; | |
| 7331 | |||
| 7332 | case iDivineProtection: | ||
| 7333 | 82 | tempitem.flags |= get_bit(deprecated_rules,qr_FLICKERINGDIVINEPROTECTIONROCKET_DEP) ? ITEM_FLAG1 : 0; | |
| 7334 | 82 | tempitem.flags |= get_bit(deprecated_rules,qr_TRANSLUCENTDIVINEPROTECTIONROCKET_DEP) ? ITEM_FLAG2 : 0; | |
| 7335 | 82 | tempitem.wpn=wDIVINEPROTECTION1A; | |
| 7336 | 82 | tempitem.wpn2=wDIVINEPROTECTION1B; | |
| 7337 | 82 | tempitem.wpn3=wDIVINEPROTECTIONS1A; | |
| 7338 | 82 | tempitem.wpn4=wDIVINEPROTECTIONS1B; | |
| 7339 | 82 | tempitem.wpn6=wDIVINEPROTECTION2A; | |
| 7340 | 82 | tempitem.wpn7=wDIVINEPROTECTION2B; | |
| 7341 | 82 | tempitem.wpn8=wDIVINEPROTECTIONS2A; | |
| 7342 | 82 | tempitem.wpn9=wDIVINEPROTECTIONS2B; | |
| 7343 | 82 | tempitem.wpn5 = iwDivineProtectionShieldFront; | |
| 7344 | 82 | tempitem.wpn10 = iwDivineProtectionShieldBack; | |
| 7345 | 82 | tempitem.misc1=512; | |
| 7346 | 82 | tempitem.cost_amount[0]=64; | |
| 7347 | 82 | break; | |
| 7348 | |||
| 7349 | case iLens: | ||
| 7350 | 82 | tempitem.misc1=60; | |
| 7351 | 82 | tempitem.flags |= get_qr(qr_ENABLEMAGIC) ? 0 : ITEM_RUPEE_MAGIC; | |
| 7352 | 82 | tempitem.cost_amount[0] = get_qr(qr_ENABLEMAGIC) ? 2 : 1; | |
| 7353 | 82 | break; | |
| 7354 | |||
| 7355 | case iArrow: | ||
| 7356 | 82 | tempitem.power=2; | |
| 7357 | 82 | tempitem.wpn=wARROW; | |
| 7358 | 82 | break; | |
| 7359 | |||
| 7360 | case iHoverBoots: | ||
| 7361 | 82 | tempitem.misc1=45; | |
| 7362 | 82 | tempitem.wpn=iwHover; | |
| 7363 | 82 | break; | |
| 7364 | |||
| 7365 | case iDivineFire: | ||
| 7366 | 82 | tempitem.power=8; | |
| 7367 | 82 | tempitem.wpn=wDIVINEFIRE1A; | |
| 7368 | 82 | tempitem.wpn2=wDIVINEFIRE1B; | |
| 7369 | 82 | tempitem.wpn3=wDIVINEFIRES1A; | |
| 7370 | 82 | tempitem.wpn4=wDIVINEFIRES1B; | |
| 7371 | 82 | tempitem.misc1 = 32; | |
| 7372 | 82 | tempitem.misc2 = 200; | |
| 7373 | 82 | tempitem.cost_amount[0]=32; | |
| 7374 | 82 | break; | |
| 7375 | |||
| 7376 | case iDivineEscape: | ||
| 7377 | 82 | tempitem.cost_amount[0]=32; | |
| 7378 | 82 | break; | |
| 7379 | |||
| 7380 | case iHookshot: | ||
| 7381 | 82 | tempitem.power=0; | |
| 7382 | 82 | tempitem.flags&=~ITEM_FLAG1; | |
| 7383 | 82 | tempitem.wpn=wHSHEAD; | |
| 7384 | 82 | tempitem.wpn2=wHSCHAIN_H; | |
| 7385 | 82 | tempitem.wpn4=wHSHANDLE; | |
| 7386 | 82 | tempitem.wpn3=wHSCHAIN_V; | |
| 7387 | 82 | tempitem.misc1=50; | |
| 7388 | 82 | tempitem.misc2=100; | |
| 7389 | 82 | break; | |
| 7390 | |||
| 7391 | case iLongshot: | ||
| 7392 | 82 | tempitem.power=0; | |
| 7393 | 82 | tempitem.flags&=~ITEM_FLAG1; | |
| 7394 | 82 | tempitem.wpn=wLSHEAD; | |
| 7395 | 82 | tempitem.wpn2=wLSCHAIN_H; | |
| 7396 | 82 | tempitem.wpn4=wLSHANDLE; | |
| 7397 | 82 | tempitem.wpn3=wLSCHAIN_V; | |
| 7398 | 82 | tempitem.misc1=99; | |
| 7399 | 82 | tempitem.misc2=100; | |
| 7400 | 82 | break; | |
| 7401 | |||
| 7402 | case iHammer: | ||
| 7403 | 82 | tempitem.power=4; | |
| 7404 | 82 | tempitem.wpn=wHAMMER; | |
| 7405 | 82 | tempitem.wpn2=iwHammerSmack; | |
| 7406 | 82 | break; | |
| 7407 | |||
| 7408 | case iCByrna: | ||
| 7409 | 82 | tempitem.power=1; | |
| 7410 | 82 | tempitem.wpn=wCBYRNA; | |
| 7411 | 82 | tempitem.wpn2=wCBYRNASLASH; | |
| 7412 | 82 | tempitem.wpn3=wCBYRNAORB; | |
| 7413 | 82 | tempitem.misc1=4; | |
| 7414 | 82 | tempitem.misc2=16; | |
| 7415 | 82 | tempitem.misc3=1; | |
| 7416 | 82 | tempitem.cost_amount[0]=1; | |
| 7417 | 82 | break; | |
| 7418 | |||
| 7419 | case iWhistle: | ||
| 7420 | 82 | tempitem.wpn=wWIND; | |
| 7421 | 82 | tempitem.misc1=3; | |
| 7422 | 82 | tempitem.flags|=ITEM_FLAG1; | |
| 7423 | 82 | break; | |
| 7424 | |||
| 7425 | case iBRing: | ||
| 7426 | 82 | tempitem.power=2; | |
| 7427 | 82 | tempitem.misc1=spBLUE; | |
| 7428 | 82 | break; | |
| 7429 | |||
| 7430 | case iRRing: | ||
| 7431 | 82 | tempitem.power=4; | |
| 7432 | 82 | tempitem.misc1=spRED; | |
| 7433 | 82 | break; | |
| 7434 | |||
| 7435 | case iGRing: | ||
| 7436 | 82 | tempitem.power=8; | |
| 7437 | 82 | tempitem.misc1=spGOLD; | |
| 7438 | 82 | break; | |
| 7439 | |||
| 7440 | case iSpinScroll: | ||
| 7441 | 82 | tempitem.power = 2; | |
| 7442 | 82 | tempitem.misc1 = 1; | |
| 7443 | 82 | break; | |
| 7444 | |||
| 7445 | case iL2SpinScroll: | ||
| 7446 | 82 | tempitem.family=itype_spinscroll2; | |
| 7447 | 82 | tempitem.fam_type=1; | |
| 7448 | 82 | tempitem.cost_amount[0]=8; | |
| 7449 | 82 | tempitem.power=2; | |
| 7450 | 82 | tempitem.misc1 = 20; | |
| 7451 | 82 | break; | |
| 7452 | |||
| 7453 | case iQuakeScroll: | ||
| 7454 | 82 | tempitem.misc1=0x10; | |
| 7455 | 82 | tempitem.misc2=64; | |
| 7456 | 82 | break; | |
| 7457 | |||
| 7458 | case iL2QuakeScroll: | ||
| 7459 | 82 | tempitem.family=itype_quakescroll2; | |
| 7460 | 82 | tempitem.fam_type=1; | |
| 7461 | 82 | tempitem.power = 2; | |
| 7462 | 82 | tempitem.misc1=0x20; | |
| 7463 | 82 | tempitem.misc2=192; | |
| 7464 | 82 | tempitem.cost_amount[0]=8; | |
| 7465 | 82 | break; | |
| 7466 | |||
| 7467 | case iChargeRing: | ||
| 7468 | 82 | tempitem.misc1=64; | |
| 7469 | 82 | tempitem.misc2=128; | |
| 7470 | 82 | break; | |
| 7471 | |||
| 7472 | case iL2ChargeRing: | ||
| 7473 | 82 | tempitem.misc1=32; | |
| 7474 | 82 | tempitem.misc2=64; | |
| 7475 | 82 | break; | |
| 7476 | |||
| 7477 | case iOldGlove: | ||
| 7478 | 82 | tempitem.flags |= ITEM_FLAG1; | |
| 7479 | |||
| 7480 | //fallthrough | ||
| 7481 | case iBombBagL4: | ||
| 7482 | case iWalletL3: | ||
| 7483 | case iQuiverL4: | ||
| 7484 | case iBracelet: | ||
| 7485 | 410 | tempitem.power = 1; | |
| 7486 | 410 | break; | |
| 7487 | |||
| 7488 | case iL2Bracelet: | ||
| 7489 | 82 | tempitem.power = 2; | |
| 7490 | 82 | break; | |
| 7491 | |||
| 7492 | case iMKey: | ||
| 7493 | 82 | tempitem.power=0xFF; | |
| 7494 | 82 | tempitem.flags |= ITEM_FLAG1; | |
| 7495 | 82 | break; | |
| 7496 | } | ||
| 7497 | 20992 | } | |
| 7498 | |||
| 7499 |
2/2✓ Branch 0 taken 156672 times.
✓ Branch 1 taken 20992 times.
|
177664 | if(s_version < 7) |
| 7500 | { | ||
| 7501 |
2/2✓ Branch 0 taken 328 times.
✓ Branch 1 taken 20664 times.
|
20992 | switch(i) |
| 7502 | { | ||
| 7503 | case iStoneAgony: | ||
| 7504 | case iStompBoots: | ||
| 7505 | case iPerilRing: | ||
| 7506 | case iWhimsicalRing: | ||
| 7507 | { | ||
| 7508 | 328 | reset_itembuf(&tempitem, i); | |
| 7509 | 328 | strcpy(item_string[i],old_item_string[i]); | |
| 7510 | 328 | break; | |
| 7511 | } | ||
| 7512 | } | ||
| 7513 | 20992 | } | |
| 7514 | |||
| 7515 |
2/2✓ Branch 0 taken 156672 times.
✓ Branch 1 taken 20992 times.
|
177664 | if(s_version < 8) // May 2007: Some corrections. |
| 7516 | { | ||
| 7517 |
7/7✓ Branch 0 taken 82 times.
✓ Branch 1 taken 246 times.
✓ Branch 2 taken 20336 times.
✓ Branch 3 taken 82 times.
✓ Branch 4 taken 82 times.
✓ Branch 5 taken 82 times.
✓ Branch 6 taken 82 times.
|
20992 | switch(i) |
| 7518 | { | ||
| 7519 | case iMShield: | ||
| 7520 | 82 | tempitem.misc1|=shFLAME; | |
| 7521 | 82 | tempitem.misc2|=shFIREBALL|shMAGIC; | |
| 7522 | |||
| 7523 |
1/2✓ Branch 0 taken 82 times.
✗ Branch 1 not taken.
|
82 | if(get_qr(qr_SWORDMIRROR)) |
| 7524 | { | ||
| 7525 | ✗ | tempitem.misc2 |= shSWORD; | |
| 7526 | ✗ | } | |
| 7527 | |||
| 7528 | // fallthrough | ||
| 7529 | case iShield: | ||
| 7530 | 164 | tempitem.misc1|=shFIREBALL|shSWORD|shMAGIC; | |
| 7531 | |||
| 7532 | // fallthrough | ||
| 7533 | case iSShield: | ||
| 7534 | 246 | tempitem.misc1|=shROCK|shARROW|shBRANG|shSCRIPT; | |
| 7535 | |||
| 7536 |
1/2✓ Branch 0 taken 246 times.
✗ Branch 1 not taken.
|
246 | if(get_bit(deprecated_rules,102)) //qr_REFLECTROCKS |
| 7537 | { | ||
| 7538 | ✗ | tempitem.misc2 |= shROCK; | |
| 7539 | ✗ | } | |
| 7540 | |||
| 7541 | 246 | break; | |
| 7542 | |||
| 7543 | case iWhispRing: | ||
| 7544 | 82 | tempitem.power=1; | |
| 7545 | 82 | tempitem.flags|=ITEM_GAMEDATA|ITEM_FLAG1; | |
| 7546 | 82 | tempitem.misc1 = 3; | |
| 7547 | 82 | break; | |
| 7548 | |||
| 7549 | case iL2WhispRing: | ||
| 7550 | 82 | tempitem.power=0; | |
| 7551 | 82 | tempitem.flags|=ITEM_GAMEDATA|ITEM_FLAG1; | |
| 7552 | 82 | tempitem.misc1 = 3; | |
| 7553 | 82 | break; | |
| 7554 | |||
| 7555 | case iL2Ladder: | ||
| 7556 | case iBow: | ||
| 7557 | case iCByrna: | ||
| 7558 | 246 | tempitem.power = 1; | |
| 7559 | 246 | break; | |
| 7560 | } | ||
| 7561 | 20992 | } | |
| 7562 | |||
| 7563 |
4/4✓ Branch 0 taken 20992 times.
✓ Branch 1 taken 156672 times.
✓ Branch 2 taken 20910 times.
✓ Branch 3 taken 82 times.
|
177664 | if(s_version < 9 && i==iClock) |
| 7564 | { | ||
| 7565 | 82 | tempitem.misc1 = get_bit(deprecated_rules, qr_TEMPCLOCKS_DEP) ? 256 : 0; | |
| 7566 | 82 | } | |
| 7567 | |||
| 7568 | //add the misc flag for bomb | ||
| 7569 |
4/4✓ Branch 0 taken 20992 times.
✓ Branch 1 taken 156672 times.
✓ Branch 2 taken 20910 times.
✓ Branch 3 taken 82 times.
|
177664 | if(s_version < 10 && tempitem.family == itype_bomb) |
| 7570 | { | ||
| 7571 | 82 | tempitem.flags = (tempitem.flags & ~ITEM_FLAG1) | (get_qr(qr_LONGBOMBBOOM_DEP) ? ITEM_FLAG1 : 0); | |
| 7572 | 82 | } | |
| 7573 | |||
| 7574 |
4/4✓ Branch 0 taken 20992 times.
✓ Branch 1 taken 156672 times.
✓ Branch 2 taken 20828 times.
✓ Branch 3 taken 164 times.
|
177664 | if(s_version < 11 && tempitem.family == itype_triforcepiece) |
| 7575 | { | ||
| 7576 | 164 | tempitem.flags = (tempitem.fam_type ? ITEM_GAMEDATA : 0); | |
| 7577 | 164 | tempitem.playsound = (tempitem.fam_type ? WAV_SCALE : WAV_CLEARED); | |
| 7578 | 164 | } | |
| 7579 | |||
| 7580 |
2/2✓ Branch 0 taken 156672 times.
✓ Branch 1 taken 20992 times.
|
177664 | if(s_version < 12) // June 2007: More Misc. attributes. |
| 7581 | { | ||
| 7582 |
5/5✓ Branch 0 taken 82 times.
✓ Branch 1 taken 164 times.
✓ Branch 2 taken 20582 times.
✓ Branch 3 taken 82 times.
✓ Branch 4 taken 82 times.
|
20992 | switch(i) |
| 7583 | { | ||
| 7584 | case iFBrang: | ||
| 7585 | 82 | tempitem.misc4 |= shFIREBALL|shSWORD|shMAGIC; | |
| 7586 | |||
| 7587 | //fallthrough | ||
| 7588 | case iMBrang: | ||
| 7589 | 164 | tempitem.misc3 |= shSWORD|shMAGIC; | |
| 7590 | |||
| 7591 | //fallthrough | ||
| 7592 | case iHookshot: | ||
| 7593 | case iLongshot: | ||
| 7594 | //fallthrough | ||
| 7595 | 328 | tempitem.misc3 |= shFIREBALL; | |
| 7596 | |||
| 7597 | case iBrang: | ||
| 7598 | 410 | tempitem.misc3 |= shBRANG|shROCK|shARROW; | |
| 7599 | 410 | break; | |
| 7600 | } | ||
| 7601 | |||
| 7602 |
16/16✓ Branch 0 taken 82 times.
✓ Branch 1 taken 82 times.
✓ Branch 2 taken 82 times.
✓ Branch 3 taken 246 times.
✓ Branch 4 taken 246 times.
✓ Branch 5 taken 82 times.
✓ Branch 6 taken 82 times.
✓ Branch 7 taken 82 times.
✓ Branch 8 taken 328 times.
✓ Branch 9 taken 164 times.
✓ Branch 10 taken 9629 times.
✓ Branch 11 taken 164 times.
✓ Branch 12 taken 246 times.
✓ Branch 13 taken 9313 times.
✓ Branch 14 taken 82 times.
✓ Branch 15 taken 82 times.
|
20992 | switch(tempitem.family) |
| 7603 | { | ||
| 7604 | case itype_hoverboots: | ||
| 7605 | 82 | tempitem.usesound = WAV_ZN1HOVER; | |
| 7606 | 82 | break; | |
| 7607 | |||
| 7608 | case itype_wand: | ||
| 7609 | 82 | tempitem.usesound = WAV_WAND; | |
| 7610 | 82 | break; | |
| 7611 | |||
| 7612 | case itype_book: | ||
| 7613 | 82 | tempitem.usesound = WAV_FIRE; | |
| 7614 | 82 | break; | |
| 7615 | |||
| 7616 | case itype_arrow: | ||
| 7617 | 246 | tempitem.usesound = WAV_ARROW; | |
| 7618 | 246 | break; | |
| 7619 | |||
| 7620 | case itype_hookshot: | ||
| 7621 | 164 | tempitem.usesound = WAV_HOOKSHOT; | |
| 7622 | 164 | break; | |
| 7623 | |||
| 7624 | case itype_brang: | ||
| 7625 | 246 | tempitem.usesound = WAV_BRANG; | |
| 7626 | 246 | break; | |
| 7627 | |||
| 7628 | case itype_shield: | ||
| 7629 | 246 | tempitem.usesound = WAV_CHINK; | |
| 7630 | 246 | break; | |
| 7631 | |||
| 7632 | case itype_sword: | ||
| 7633 | 9313 | tempitem.usesound = WAV_SWORD; | |
| 7634 | 9313 | break; | |
| 7635 | |||
| 7636 | case itype_whistle: | ||
| 7637 | 82 | tempitem.usesound = WAV_WHISTLE; | |
| 7638 | 82 | break; | |
| 7639 | |||
| 7640 | case itype_hammer: | ||
| 7641 | 82 | tempitem.usesound = WAV_HAMMER; | |
| 7642 | 82 | break; | |
| 7643 | |||
| 7644 | case itype_divinefire: | ||
| 7645 | 82 | tempitem.usesound = WAV_ZN1DIVINEFIRE; | |
| 7646 | 82 | break; | |
| 7647 | |||
| 7648 | case itype_divineescape: | ||
| 7649 | 82 | tempitem.usesound = WAV_ZN1DIVINEESCAPE; | |
| 7650 | 82 | break; | |
| 7651 | |||
| 7652 | case itype_divineprotection: | ||
| 7653 | 82 | tempitem.usesound = WAV_ZN1DIVINEPROTECTION1; | |
| 7654 | 82 | break; | |
| 7655 | |||
| 7656 | case itype_bomb: | ||
| 7657 | case itype_sbomb: | ||
| 7658 | case itype_quakescroll: | ||
| 7659 | case itype_quakescroll2: | ||
| 7660 | 328 | tempitem.usesound = WAV_BOMB; | |
| 7661 | 328 | break; | |
| 7662 | |||
| 7663 | case itype_spinscroll: | ||
| 7664 | case itype_spinscroll2: | ||
| 7665 | 164 | tempitem.usesound = WAV_ZN1SPINATTACK; | |
| 7666 | 164 | break; | |
| 7667 | } | ||
| 7668 | 20992 | } | |
| 7669 | |||
| 7670 |
2/2✓ Branch 0 taken 156672 times.
✓ Branch 1 taken 20992 times.
|
177664 | if(s_version < 13) // July 2007 |
| 7671 | { | ||
| 7672 |
2/2✓ Branch 0 taken 82 times.
✓ Branch 1 taken 20910 times.
|
20992 | if(tempitem.family == itype_whistle) |
| 7673 | { | ||
| 7674 | 82 | tempitem.misc1 = (tempitem.power==2 ? 4 : 3); | |
| 7675 | 82 | tempitem.power = 1; | |
| 7676 | 82 | tempitem.flags|=ITEM_FLAG1; | |
| 7677 | 82 | } | |
| 7678 |
2/2✓ Branch 0 taken 82 times.
✓ Branch 1 taken 20828 times.
|
20910 | else if(tempitem.family == itype_wand) |
| 7679 | 82 | tempitem.flags|=ITEM_FLAG1; | |
| 7680 |
2/2✓ Branch 0 taken 20746 times.
✓ Branch 1 taken 82 times.
|
20828 | else if(tempitem.family == itype_book) |
| 7681 | { | ||
| 7682 | 82 | tempitem.flags|=ITEM_FLAG1; | |
| 7683 | 82 | tempitem.power = 2; | |
| 7684 | 82 | } | |
| 7685 | 20992 | } | |
| 7686 | |||
| 7687 |
2/2✓ Branch 0 taken 156672 times.
✓ Branch 1 taken 20992 times.
|
177664 | if(s_version < 14) // August 2007 |
| 7688 | { | ||
| 7689 |
2/2✓ Branch 0 taken 164 times.
✓ Branch 1 taken 20828 times.
|
20992 | if(tempitem.family == itype_fairy) |
| 7690 | { | ||
| 7691 | 164 | tempitem.usesound = WAV_SCALE; | |
| 7692 | |||
| 7693 |
1/2✓ Branch 0 taken 164 times.
✗ Branch 1 not taken.
|
164 | if(tempitem.fam_type) |
| 7694 | 164 | tempitem.misc3=50; | |
| 7695 | 164 | } | |
| 7696 |
2/2✓ Branch 0 taken 20664 times.
✓ Branch 1 taken 164 times.
|
20828 | else if(tempitem.family == itype_potion) |
| 7697 | { | ||
| 7698 | 164 | tempitem.flags |= ITEM_GAINOLD; | |
| 7699 | 164 | } | |
| 7700 | 20992 | } | |
| 7701 | |||
| 7702 |
2/2✓ Branch 0 taken 156672 times.
✓ Branch 1 taken 20992 times.
|
177664 | if(s_version < 17) // November 2007 |
| 7703 | { | ||
| 7704 |
3/4✓ Branch 0 taken 164 times.
✓ Branch 1 taken 20828 times.
✓ Branch 2 taken 164 times.
✗ Branch 3 not taken.
|
20992 | if(tempitem.family == itype_candle && !tempitem.wpn3) |
| 7705 | { | ||
| 7706 | ✗ | tempitem.wpn3 = wFIRE; | |
| 7707 | ✗ | } | |
| 7708 |
4/4✓ Branch 0 taken 246 times.
✓ Branch 1 taken 20746 times.
✓ Branch 2 taken 164 times.
✓ Branch 3 taken 82 times.
|
20992 | else if(tempitem.family == itype_arrow && tempitem.power>4) |
| 7709 | { | ||
| 7710 | 82 | tempitem.flags|=ITEM_FLAG1; | |
| 7711 | 82 | } | |
| 7712 | 20992 | } | |
| 7713 | |||
| 7714 |
2/2✓ Branch 0 taken 156672 times.
✓ Branch 1 taken 20992 times.
|
177664 | if(s_version < 18) // New Year's Eve 2007 |
| 7715 | { | ||
| 7716 |
2/2✓ Branch 0 taken 82 times.
✓ Branch 1 taken 20910 times.
|
20992 | if(tempitem.family == itype_whistle) |
| 7717 | 82 | tempitem.misc2 = 8; // Use the Whistle warp ring | |
| 7718 |
2/2✓ Branch 0 taken 82 times.
✓ Branch 1 taken 20828 times.
|
20910 | else if(tempitem.family == itype_bait) |
| 7719 | 82 | tempitem.misc1 = 768; // Frames until it goes | |
| 7720 |
2/2✓ Branch 0 taken 20664 times.
✓ Branch 1 taken 164 times.
|
20828 | else if(tempitem.family == itype_triforcepiece) |
| 7721 | { | ||
| 7722 |
2/2✓ Branch 0 taken 82 times.
✓ Branch 1 taken 82 times.
|
164 | if(tempitem.flags & ITEM_GAMEDATA) |
| 7723 | { | ||
| 7724 | 82 | tempitem.misc2 = 1; // Cutscene 1 | |
| 7725 | 82 | tempitem.flags |= ITEM_FLAG1; // Side Warp Out | |
| 7726 | 82 | } | |
| 7727 | 164 | } | |
| 7728 | 20992 | } | |
| 7729 | |||
| 7730 |
2/2✓ Branch 0 taken 156672 times.
✓ Branch 1 taken 20992 times.
|
177664 | if(s_version < 19) // January 2008 |
| 7731 | { | ||
| 7732 |
2/2✓ Branch 0 taken 20910 times.
✓ Branch 1 taken 82 times.
|
20992 | if(tempitem.family == itype_divineprotection) |
| 7733 | { | ||
| 7734 | 82 | tempitem.flags |= get_bit(deprecated_rules,qr_NOBOMBPALFLASH+1)?ITEM_FLAG3:0; | |
| 7735 | 82 | tempitem.flags |= get_bit(deprecated_rules,qr_NOBOMBPALFLASH+2)?ITEM_FLAG4:0; | |
| 7736 | 82 | } | |
| 7737 | 20992 | } | |
| 7738 | |||
| 7739 |
2/2✓ Branch 0 taken 156672 times.
✓ Branch 1 taken 20992 times.
|
177664 | if(s_version < 20) // October 2008 |
| 7740 | { | ||
| 7741 |
2/2✓ Branch 0 taken 20910 times.
✓ Branch 1 taken 82 times.
|
20992 | if(tempitem.family == itype_divineprotection) |
| 7742 | { | ||
| 7743 | 82 | tempitem.wpn6=wDIVINEPROTECTION2A; | |
| 7744 | 82 | tempitem.wpn7=wDIVINEPROTECTION2B; | |
| 7745 | 82 | tempitem.wpn8=wDIVINEPROTECTIONS2A; | |
| 7746 | 82 | tempitem.wpn9=wDIVINEPROTECTIONS2B; | |
| 7747 | 82 | tempitem.wpn5 = iwDivineProtectionShieldFront; | |
| 7748 | 82 | tempitem.wpn10 = iwDivineProtectionShieldBack; | |
| 7749 | 82 | } | |
| 7750 | 20992 | } | |
| 7751 | |||
| 7752 |
2/2✓ Branch 0 taken 156672 times.
✓ Branch 1 taken 20992 times.
|
177664 | if(s_version < 21) // November 2008 |
| 7753 | { | ||
| 7754 |
1/2✓ Branch 0 taken 20992 times.
✗ Branch 1 not taken.
|
20992 | if(tempitem.flags & 0x0100) // ITEM_SLASH |
| 7755 | { | ||
| 7756 | ✗ | tempitem.flags &= ~0x0100; | |
| 7757 | |||
| 7758 | ✗ | if(tempitem.family == itype_sword || | |
| 7759 | ✗ | tempitem.family == itype_wand || | |
| 7760 | ✗ | tempitem.family == itype_candle || | |
| 7761 | ✗ | tempitem.family == itype_cbyrna) | |
| 7762 | { | ||
| 7763 | ✗ | tempitem.flags |= ITEM_FLAG4; | |
| 7764 | ✗ | } | |
| 7765 | ✗ | } | |
| 7766 | 20992 | } | |
| 7767 | |||
| 7768 |
2/2✓ Branch 0 taken 156672 times.
✓ Branch 1 taken 20992 times.
|
177664 | if(s_version < 22) // September 2009 |
| 7769 | { | ||
| 7770 |
4/4✓ Branch 0 taken 20910 times.
✓ Branch 1 taken 82 times.
✓ Branch 2 taken 82 times.
✓ Branch 3 taken 20828 times.
|
20992 | if(tempitem.family == itype_sbomb || tempitem.family == itype_bomb) |
| 7771 | { | ||
| 7772 | 164 | tempitem.misc3 = tempitem.power/2; | |
| 7773 | 164 | } | |
| 7774 | 20992 | } | |
| 7775 | |||
| 7776 |
2/2✓ Branch 0 taken 156672 times.
✓ Branch 1 taken 20992 times.
|
177664 | if(s_version < 23) // March 2011 |
| 7777 | { | ||
| 7778 |
2/2✓ Branch 0 taken 82 times.
✓ Branch 1 taken 20910 times.
|
20992 | if(tempitem.family == itype_divinefire) |
| 7779 | 82 | tempitem.wpn5 = wFIRE; | |
| 7780 |
2/2✓ Branch 0 taken 20828 times.
✓ Branch 1 taken 82 times.
|
20910 | else if(tempitem.family == itype_book) |
| 7781 | 82 | tempitem.wpn2 = wFIRE; | |
| 7782 | 20992 | } | |
| 7783 | |||
| 7784 | // Version 25: Bomb bags were acting as though "super bombs also" was checked | ||
| 7785 | // whether it was or not, and a lot of existing quests depended on the | ||
| 7786 | // incorrect behavior. | ||
| 7787 |
2/2✓ Branch 0 taken 156672 times.
✓ Branch 1 taken 20992 times.
|
177664 | if(s_version < 25) // January 2012 |
| 7788 | { | ||
| 7789 |
2/2✓ Branch 0 taken 20664 times.
✓ Branch 1 taken 328 times.
|
20992 | if(tempitem.family == itype_bombbag) |
| 7790 | 328 | tempitem.flags |= 16; | |
| 7791 | |||
| 7792 |
2/2✓ Branch 0 taken 20910 times.
✓ Branch 1 taken 82 times.
|
20992 | if(tempitem.family == itype_divinefire) |
| 7793 | 82 | tempitem.flags |= ITEM_FLAG3; // Sideview gravity flag | |
| 7794 | 20992 | } | |
| 7795 | |||
| 7796 |
2/2✓ Branch 0 taken 108288 times.
✓ Branch 1 taken 69376 times.
|
177664 | if( version < 0x254) //Nuke greyed-out flags/values from <=2.53, in case they are used in 2.54/2.55 |
| 7797 | { | ||
| 7798 |
60/60✓ Branch 0 taken 17515 times.
✓ Branch 1 taken 813 times.
✓ Branch 2 taken 801 times.
✓ Branch 3 taken 580 times.
✓ Branch 4 taken 317 times.
✓ Branch 5 taken 271 times.
✓ Branch 6 taken 538 times.
✓ Branch 7 taken 593 times.
✓ Branch 8 taken 287 times.
✓ Branch 9 taken 861 times.
✓ Branch 10 taken 861 times.
✓ Branch 11 taken 534 times.
✓ Branch 12 taken 821 times.
✓ Branch 13 taken 538 times.
✓ Branch 14 taken 269 times.
✓ Branch 15 taken 538 times.
✓ Branch 16 taken 285 times.
✓ Branch 17 taken 269 times.
✓ Branch 18 taken 813 times.
✓ Branch 19 taken 271 times.
✓ Branch 20 taken 273 times.
✓ Branch 21 taken 540 times.
✓ Branch 22 taken 245 times.
✓ Branch 23 taken 271 times.
✓ Branch 24 taken 269 times.
✓ Branch 25 taken 269 times.
✓ Branch 26 taken 269 times.
✓ Branch 27 taken 285 times.
✓ Branch 28 taken 271 times.
✓ Branch 29 taken 271 times.
✓ Branch 30 taken 269 times.
✓ Branch 31 taken 273 times.
✓ Branch 32 taken 538 times.
✓ Branch 33 taken 1076 times.
✓ Branch 34 taken 759 times.
✓ Branch 35 taken 269 times.
✓ Branch 36 taken 523 times.
✓ Branch 37 taken 1076 times.
✓ Branch 38 taken 269 times.
✓ Branch 39 taken 269 times.
✓ Branch 40 taken 269 times.
✓ Branch 41 taken 269 times.
✓ Branch 42 taken 269 times.
✓ Branch 43 taken 540 times.
✓ Branch 44 taken 538 times.
✓ Branch 45 taken 269 times.
✓ Branch 46 taken 809 times.
✓ Branch 47 taken 811 times.
✓ Branch 48 taken 1084 times.
✓ Branch 49 taken 269 times.
✓ Branch 50 taken 269 times.
✓ Branch 51 taken 269 times.
✓ Branch 52 taken 269 times.
✓ Branch 53 taken 269 times.
✓ Branch 54 taken 295 times.
✓ Branch 55 taken 9413 times.
✓ Branch 56 taken 2766 times.
✓ Branch 57 taken 811 times.
✓ Branch 58 taken 3150 times.
✓ Branch 59 taken 10679 times.
|
69376 | switch(tempitem.family) |
| 7799 | { | ||
| 7800 | case itype_sword: | ||
| 7801 | { | ||
| 7802 | 17515 | tempitem.flags &= ~(ITEM_FLAG5); | |
| 7803 | 17515 | tempitem.misc3 = 0; | |
| 7804 | 17515 | tempitem.misc4 = 0; | |
| 7805 | 17515 | tempitem.misc5 = 0; | |
| 7806 | 17515 | tempitem.misc6 = 0; | |
| 7807 | 17515 | tempitem.misc7 = 0; | |
| 7808 | 17515 | tempitem.misc8 = 0; | |
| 7809 | 17515 | tempitem.misc9 = 0; | |
| 7810 | 17515 | tempitem.misc10 = 0; | |
| 7811 | 17515 | tempitem.wpn4 = 0; | |
| 7812 | 17515 | tempitem.wpn5 = 0; | |
| 7813 | 17515 | tempitem.wpn6 = 0; | |
| 7814 | 17515 | tempitem.wpn7 = 0; | |
| 7815 | 17515 | tempitem.wpn8 = 0; | |
| 7816 | 17515 | tempitem.wpn9 = 0; | |
| 7817 | 17515 | tempitem.wpn10 = 0; | |
| 7818 | 17515 | break; | |
| 7819 | } | ||
| 7820 | case itype_brang: | ||
| 7821 | { | ||
| 7822 | 813 | tempitem.flags &= ~(ITEM_FLAG4 | ITEM_FLAG5); | |
| 7823 | 813 | tempitem.misc2 = 0; | |
| 7824 | 813 | tempitem.misc5 = 0; | |
| 7825 | 813 | tempitem.misc6 = 0; | |
| 7826 | 813 | tempitem.misc7 = 0; | |
| 7827 | 813 | tempitem.misc8 = 0; | |
| 7828 | 813 | tempitem.misc9 = 0; | |
| 7829 | 813 | tempitem.misc10 = 0; | |
| 7830 | 813 | tempitem.wpn4 = 0; | |
| 7831 | 813 | tempitem.wpn5 = 0; | |
| 7832 | 813 | tempitem.wpn6 = 0; | |
| 7833 | 813 | tempitem.wpn7 = 0; | |
| 7834 | 813 | tempitem.wpn8 = 0; | |
| 7835 | 813 | tempitem.wpn9 = 0; | |
| 7836 | 813 | tempitem.wpn10 = 0; | |
| 7837 | 813 | break; | |
| 7838 | } | ||
| 7839 | case itype_arrow: | ||
| 7840 | { | ||
| 7841 | 801 | tempitem.flags &= ~ (ITEM_FLAG2 | ITEM_FLAG3 | ITEM_FLAG4 | ITEM_FLAG5); | |
| 7842 | 801 | tempitem.misc2 = 0; | |
| 7843 | 801 | tempitem.misc3 = 0; | |
| 7844 | 801 | tempitem.misc4 = 0; | |
| 7845 | 801 | tempitem.misc5 = 0; | |
| 7846 | 801 | tempitem.misc6 = 0; | |
| 7847 | 801 | tempitem.misc7 = 0; | |
| 7848 | 801 | tempitem.misc8 = 0; | |
| 7849 | 801 | tempitem.misc9 = 0; | |
| 7850 | 801 | tempitem.misc10 = 0; | |
| 7851 | 801 | tempitem.wpn4 = 0; | |
| 7852 | 801 | tempitem.wpn5 = 0; | |
| 7853 | 801 | tempitem.wpn6 = 0; | |
| 7854 | 801 | tempitem.wpn7 = 0; | |
| 7855 | 801 | tempitem.wpn8 = 0; | |
| 7856 | 801 | tempitem.wpn9 = 0; | |
| 7857 | 801 | tempitem.wpn10 = 0; | |
| 7858 | 801 | break; | |
| 7859 | } | ||
| 7860 | case itype_candle: | ||
| 7861 | { | ||
| 7862 | 580 | tempitem.flags &= ~ (ITEM_FLAG3 | ITEM_FLAG5); | |
| 7863 | 580 | tempitem.misc1 = 0; | |
| 7864 | 580 | tempitem.misc2 = 0; | |
| 7865 | 580 | tempitem.misc3 = 0; | |
| 7866 | 580 | tempitem.misc4 = 0; | |
| 7867 | 580 | tempitem.misc5 = 0; | |
| 7868 | 580 | tempitem.misc6 = 0; | |
| 7869 | 580 | tempitem.misc7 = 0; | |
| 7870 | 580 | tempitem.misc8 = 0; | |
| 7871 | 580 | tempitem.misc9 = 0; | |
| 7872 | 580 | tempitem.misc10 = 0; | |
| 7873 | 580 | tempitem.wpn4 = 0; | |
| 7874 | 580 | tempitem.wpn5 = 0; | |
| 7875 | 580 | tempitem.wpn6 = 0; | |
| 7876 | 580 | tempitem.wpn7 = 0; | |
| 7877 | 580 | tempitem.wpn8 = 0; | |
| 7878 | 580 | tempitem.wpn9 = 0; | |
| 7879 | 580 | tempitem.wpn10 = 0; | |
| 7880 | 580 | break; | |
| 7881 | } | ||
| 7882 | case itype_whistle: | ||
| 7883 | { | ||
| 7884 | 317 | tempitem.flags &= ~ (ITEM_FLAG2 | ITEM_FLAG3 | ITEM_FLAG4 | ITEM_FLAG5); | |
| 7885 | 317 | tempitem.misc3 = 0; | |
| 7886 | 317 | tempitem.misc4 = 0; | |
| 7887 | 317 | tempitem.misc5 = 0; | |
| 7888 | 317 | tempitem.misc6 = 0; | |
| 7889 | 317 | tempitem.misc7 = 0; | |
| 7890 | 317 | tempitem.misc8 = 0; | |
| 7891 | 317 | tempitem.misc9 = 0; | |
| 7892 | 317 | tempitem.misc10 = 0; | |
| 7893 | 317 | tempitem.wpn2 = 0; | |
| 7894 | 317 | tempitem.wpn3 = 0; | |
| 7895 | 317 | tempitem.wpn4 = 0; | |
| 7896 | 317 | tempitem.wpn5 = 0; | |
| 7897 | 317 | tempitem.wpn6 = 0; | |
| 7898 | 317 | tempitem.wpn7 = 0; | |
| 7899 | 317 | tempitem.wpn8 = 0; | |
| 7900 | 317 | tempitem.wpn9 = 0; | |
| 7901 | 317 | tempitem.wpn10 = 0; | |
| 7902 | 317 | break; | |
| 7903 | } | ||
| 7904 | case itype_bait: | ||
| 7905 | { | ||
| 7906 | 271 | tempitem.flags &= ~ (ITEM_FLAG1 | ITEM_FLAG2 | ITEM_FLAG3 | ITEM_FLAG4 | ITEM_FLAG5); | |
| 7907 | 271 | tempitem.misc2 = 0; | |
| 7908 | 271 | tempitem.misc3 = 0; | |
| 7909 | 271 | tempitem.misc4 = 0; | |
| 7910 | 271 | tempitem.misc5 = 0; | |
| 7911 | 271 | tempitem.misc6 = 0; | |
| 7912 | 271 | tempitem.misc7 = 0; | |
| 7913 | 271 | tempitem.misc8 = 0; | |
| 7914 | 271 | tempitem.misc9 = 0; | |
| 7915 | 271 | tempitem.misc10 = 0; | |
| 7916 | 271 | tempitem.wpn2 = 0; | |
| 7917 | 271 | tempitem.wpn3 = 0; | |
| 7918 | 271 | tempitem.wpn4 = 0; | |
| 7919 | 271 | tempitem.wpn5 = 0; | |
| 7920 | 271 | tempitem.wpn6 = 0; | |
| 7921 | 271 | tempitem.wpn7 = 0; | |
| 7922 | 271 | tempitem.wpn8 = 0; | |
| 7923 | 271 | tempitem.wpn9 = 0; | |
| 7924 | 271 | tempitem.wpn10 = 0; | |
| 7925 | 271 | break; | |
| 7926 | } | ||
| 7927 | case itype_letter: | ||
| 7928 | { | ||
| 7929 | 538 | tempitem.flags &= ~ (ITEM_FLAG1 | ITEM_FLAG2 | ITEM_FLAG3 | ITEM_FLAG4 | ITEM_FLAG5); | |
| 7930 | 538 | tempitem.misc1 = 0; | |
| 7931 | 538 | tempitem.misc2 = 0; | |
| 7932 | 538 | tempitem.misc3 = 0; | |
| 7933 | 538 | tempitem.misc4 = 0; | |
| 7934 | 538 | tempitem.misc5 = 0; | |
| 7935 | 538 | tempitem.misc6 = 0; | |
| 7936 | 538 | tempitem.misc7 = 0; | |
| 7937 | 538 | tempitem.misc8 = 0; | |
| 7938 | 538 | tempitem.misc9 = 0; | |
| 7939 | 538 | tempitem.misc10 = 0; | |
| 7940 | 538 | tempitem.wpn = 0; | |
| 7941 | 538 | tempitem.wpn2 = 0; | |
| 7942 | 538 | tempitem.wpn3 = 0; | |
| 7943 | 538 | tempitem.wpn4 = 0; | |
| 7944 | 538 | tempitem.wpn5 = 0; | |
| 7945 | 538 | tempitem.wpn6 = 0; | |
| 7946 | 538 | tempitem.wpn7 = 0; | |
| 7947 | 538 | tempitem.wpn8 = 0; | |
| 7948 | 538 | tempitem.wpn9 = 0; | |
| 7949 | 538 | tempitem.wpn10 = 0; | |
| 7950 | 538 | break; | |
| 7951 | } | ||
| 7952 | case itype_potion: | ||
| 7953 | { | ||
| 7954 | 593 | tempitem.flags &= ~ (ITEM_FLAG3 | ITEM_FLAG4 | ITEM_FLAG5); | |
| 7955 | 593 | tempitem.misc3 = 0; | |
| 7956 | 593 | tempitem.misc4 = 0; | |
| 7957 | 593 | tempitem.misc5 = 0; | |
| 7958 | 593 | tempitem.misc6 = 0; | |
| 7959 | 593 | tempitem.misc7 = 0; | |
| 7960 | 593 | tempitem.misc8 = 0; | |
| 7961 | 593 | tempitem.misc9 = 0; | |
| 7962 | 593 | tempitem.misc10 = 0; | |
| 7963 | 593 | tempitem.wpn = 0; | |
| 7964 | 593 | tempitem.wpn2 = 0; | |
| 7965 | 593 | tempitem.wpn3 = 0; | |
| 7966 | 593 | tempitem.wpn4 = 0; | |
| 7967 | 593 | tempitem.wpn5 = 0; | |
| 7968 | 593 | tempitem.wpn6 = 0; | |
| 7969 | 593 | tempitem.wpn7 = 0; | |
| 7970 | 593 | tempitem.wpn8 = 0; | |
| 7971 | 593 | tempitem.wpn9 = 0; | |
| 7972 | 593 | tempitem.wpn10 = 0; | |
| 7973 | 593 | break; | |
| 7974 | } | ||
| 7975 | case itype_wand: | ||
| 7976 | { | ||
| 7977 | 287 | tempitem.flags &= ~ (ITEM_FLAG2 | ITEM_FLAG3 | ITEM_FLAG5); | |
| 7978 | 287 | tempitem.misc1 = 0; | |
| 7979 | 287 | tempitem.misc2 = 0; | |
| 7980 | 287 | tempitem.misc3 = 0; | |
| 7981 | 287 | tempitem.misc4 = 0; | |
| 7982 | 287 | tempitem.misc5 = 0; | |
| 7983 | 287 | tempitem.misc6 = 0; | |
| 7984 | 287 | tempitem.misc7 = 0; | |
| 7985 | 287 | tempitem.misc8 = 0; | |
| 7986 | 287 | tempitem.misc9 = 0; | |
| 7987 | 287 | tempitem.misc10 = 0; | |
| 7988 | 287 | tempitem.wpn4 = 0; | |
| 7989 | 287 | tempitem.wpn5 = 0; | |
| 7990 | 287 | tempitem.wpn6 = 0; | |
| 7991 | 287 | tempitem.wpn7 = 0; | |
| 7992 | 287 | tempitem.wpn8 = 0; | |
| 7993 | 287 | tempitem.wpn9 = 0; | |
| 7994 | 287 | tempitem.wpn10 = 0; | |
| 7995 | 287 | break; | |
| 7996 | } | ||
| 7997 | case itype_ring: | ||
| 7998 | { | ||
| 7999 | 861 | tempitem.flags &= ~ (ITEM_FLAG1 | ITEM_FLAG2 | ITEM_FLAG3 | ITEM_FLAG4 | ITEM_FLAG5); | |
| 8000 | 861 | tempitem.misc2 = 0; | |
| 8001 | 861 | tempitem.misc3 = 0; | |
| 8002 | 861 | tempitem.misc4 = 0; | |
| 8003 | 861 | tempitem.misc5 = 0; | |
| 8004 | 861 | tempitem.misc6 = 0; | |
| 8005 | 861 | tempitem.misc7 = 0; | |
| 8006 | 861 | tempitem.misc8 = 0; | |
| 8007 | 861 | tempitem.misc9 = 0; | |
| 8008 | 861 | tempitem.misc10 = 0; | |
| 8009 | 861 | tempitem.wpn = 0; | |
| 8010 | 861 | tempitem.wpn2 = 0; | |
| 8011 | 861 | tempitem.wpn3 = 0; | |
| 8012 | 861 | tempitem.wpn4 = 0; | |
| 8013 | 861 | tempitem.wpn5 = 0; | |
| 8014 | 861 | tempitem.wpn6 = 0; | |
| 8015 | 861 | tempitem.wpn7 = 0; | |
| 8016 | 861 | tempitem.wpn8 = 0; | |
| 8017 | 861 | tempitem.wpn9 = 0; | |
| 8018 | 861 | tempitem.wpn10 = 0; | |
| 8019 | 861 | break; | |
| 8020 | } | ||
| 8021 | case itype_wallet: | ||
| 8022 | { | ||
| 8023 | 861 | tempitem.flags &= ~ (ITEM_FLAG1 | ITEM_FLAG2 | ITEM_FLAG3 | ITEM_FLAG4 | ITEM_FLAG5); | |
| 8024 | 861 | tempitem.misc3 = 0; | |
| 8025 | 861 | tempitem.misc4 = 0; | |
| 8026 | 861 | tempitem.misc5 = 0; | |
| 8027 | 861 | tempitem.misc6 = 0; | |
| 8028 | 861 | tempitem.misc7 = 0; | |
| 8029 | 861 | tempitem.misc8 = 0; | |
| 8030 | 861 | tempitem.misc9 = 0; | |
| 8031 | 861 | tempitem.misc10 = 0; | |
| 8032 | 861 | tempitem.wpn = 0; | |
| 8033 | 861 | tempitem.wpn2 = 0; | |
| 8034 | 861 | tempitem.wpn3 = 0; | |
| 8035 | 861 | tempitem.wpn4 = 0; | |
| 8036 | 861 | tempitem.wpn5 = 0; | |
| 8037 | 861 | tempitem.wpn6 = 0; | |
| 8038 | 861 | tempitem.wpn7 = 0; | |
| 8039 | 861 | tempitem.wpn8 = 0; | |
| 8040 | 861 | tempitem.wpn9 = 0; | |
| 8041 | 861 | tempitem.wpn10 = 0; | |
| 8042 | 861 | break; | |
| 8043 | } | ||
| 8044 | case itype_amulet: | ||
| 8045 | { | ||
| 8046 | 534 | tempitem.flags &= ~ (ITEM_FLAG1 | ITEM_FLAG2 | ITEM_FLAG3 | ITEM_FLAG4 | ITEM_FLAG5); | |
| 8047 | 534 | tempitem.misc1 = 0; | |
| 8048 | 534 | tempitem.misc2 = 0; | |
| 8049 | 534 | tempitem.misc3 = 0; | |
| 8050 | 534 | tempitem.misc4 = 0; | |
| 8051 | 534 | tempitem.misc5 = 0; | |
| 8052 | 534 | tempitem.misc6 = 0; | |
| 8053 | 534 | tempitem.misc7 = 0; | |
| 8054 | 534 | tempitem.misc8 = 0; | |
| 8055 | 534 | tempitem.misc9 = 0; | |
| 8056 | 534 | tempitem.misc10 = 0; | |
| 8057 | 534 | tempitem.wpn = 0; | |
| 8058 | 534 | tempitem.wpn2 = 0; | |
| 8059 | 534 | tempitem.wpn3 = 0; | |
| 8060 | 534 | tempitem.wpn4 = 0; | |
| 8061 | 534 | tempitem.wpn5 = 0; | |
| 8062 | 534 | tempitem.wpn6 = 0; | |
| 8063 | 534 | tempitem.wpn7 = 0; | |
| 8064 | 534 | tempitem.wpn8 = 0; | |
| 8065 | 534 | tempitem.wpn9 = 0; | |
| 8066 | 534 | tempitem.wpn10 = 0; | |
| 8067 | 534 | break; | |
| 8068 | } | ||
| 8069 | case itype_shield: | ||
| 8070 | { | ||
| 8071 | 821 | tempitem.flags &= ~ (ITEM_FLAG1 | ITEM_FLAG2 | ITEM_FLAG3 | ITEM_FLAG4 | ITEM_FLAG5); | |
| 8072 | 821 | tempitem.misc3 = 0; | |
| 8073 | 821 | tempitem.misc4 = 0; | |
| 8074 | 821 | tempitem.misc5 = 0; | |
| 8075 | 821 | tempitem.misc6 = 0; | |
| 8076 | 821 | tempitem.misc7 = 0; | |
| 8077 | 821 | tempitem.misc8 = 0; | |
| 8078 | 821 | tempitem.misc9 = 0; | |
| 8079 | 821 | tempitem.misc10 = 0; | |
| 8080 | 821 | tempitem.wpn = 0; | |
| 8081 | 821 | tempitem.wpn2 = 0; | |
| 8082 | 821 | tempitem.wpn3 = 0; | |
| 8083 | 821 | tempitem.wpn4 = 0; | |
| 8084 | 821 | tempitem.wpn5 = 0; | |
| 8085 | 821 | tempitem.wpn6 = 0; | |
| 8086 | 821 | tempitem.wpn7 = 0; | |
| 8087 | 821 | tempitem.wpn8 = 0; | |
| 8088 | 821 | tempitem.wpn9 = 0; | |
| 8089 | 821 | tempitem.wpn10 = 0; | |
| 8090 | 821 | break; | |
| 8091 | } | ||
| 8092 | case itype_bow: | ||
| 8093 | { | ||
| 8094 | 538 | tempitem.flags &= ~ (ITEM_FLAG1 | ITEM_FLAG2 | ITEM_FLAG3 | ITEM_FLAG4 | ITEM_FLAG5); | |
| 8095 | 538 | tempitem.misc1 = 0; | |
| 8096 | 538 | tempitem.misc2 = 0; | |
| 8097 | 538 | tempitem.misc3 = 0; | |
| 8098 | 538 | tempitem.misc4 = 0; | |
| 8099 | 538 | tempitem.misc5 = 0; | |
| 8100 | 538 | tempitem.misc6 = 0; | |
| 8101 | 538 | tempitem.misc7 = 0; | |
| 8102 | 538 | tempitem.misc8 = 0; | |
| 8103 | 538 | tempitem.misc9 = 0; | |
| 8104 | 538 | tempitem.misc10 = 0; | |
| 8105 | 538 | tempitem.wpn = 0; | |
| 8106 | 538 | tempitem.wpn2 = 0; | |
| 8107 | 538 | tempitem.wpn3 = 0; | |
| 8108 | 538 | tempitem.wpn4 = 0; | |
| 8109 | 538 | tempitem.wpn5 = 0; | |
| 8110 | 538 | tempitem.wpn6 = 0; | |
| 8111 | 538 | tempitem.wpn7 = 0; | |
| 8112 | 538 | tempitem.wpn8 = 0; | |
| 8113 | 538 | tempitem.wpn9 = 0; | |
| 8114 | 538 | tempitem.wpn10 = 0; | |
| 8115 | 538 | break; | |
| 8116 | } | ||
| 8117 | case itype_raft: | ||
| 8118 | { | ||
| 8119 | 269 | tempitem.flags &= ~ (ITEM_FLAG1 | ITEM_FLAG2 | ITEM_FLAG3 | ITEM_FLAG4 | ITEM_FLAG5); | |
| 8120 | 269 | tempitem.misc1 = 0; | |
| 8121 | 269 | tempitem.misc2 = 0; | |
| 8122 | 269 | tempitem.misc3 = 0; | |
| 8123 | 269 | tempitem.misc4 = 0; | |
| 8124 | 269 | tempitem.misc5 = 0; | |
| 8125 | 269 | tempitem.misc6 = 0; | |
| 8126 | 269 | tempitem.misc7 = 0; | |
| 8127 | 269 | tempitem.misc8 = 0; | |
| 8128 | 269 | tempitem.misc9 = 0; | |
| 8129 | 269 | tempitem.misc10 = 0; | |
| 8130 | 269 | tempitem.wpn = 0; | |
| 8131 | 269 | tempitem.wpn2 = 0; | |
| 8132 | 269 | tempitem.wpn3 = 0; | |
| 8133 | 269 | tempitem.wpn4 = 0; | |
| 8134 | 269 | tempitem.wpn5 = 0; | |
| 8135 | 269 | tempitem.wpn6 = 0; | |
| 8136 | 269 | tempitem.wpn7 = 0; | |
| 8137 | 269 | tempitem.wpn8 = 0; | |
| 8138 | 269 | tempitem.wpn9 = 0; | |
| 8139 | 269 | tempitem.wpn10 = 0; | |
| 8140 | 269 | break; | |
| 8141 | } | ||
| 8142 | case itype_ladder: | ||
| 8143 | { | ||
| 8144 | 538 | tempitem.flags &= ~ (ITEM_FLAG1 | ITEM_FLAG2 | ITEM_FLAG3 | ITEM_FLAG4 | ITEM_FLAG5); | |
| 8145 | 538 | tempitem.misc1 = 0; | |
| 8146 | 538 | tempitem.misc2 = 0; | |
| 8147 | 538 | tempitem.misc3 = 0; | |
| 8148 | 538 | tempitem.misc4 = 0; | |
| 8149 | 538 | tempitem.misc5 = 0; | |
| 8150 | 538 | tempitem.misc6 = 0; | |
| 8151 | 538 | tempitem.misc7 = 0; | |
| 8152 | 538 | tempitem.misc8 = 0; | |
| 8153 | 538 | tempitem.misc9 = 0; | |
| 8154 | 538 | tempitem.misc10 = 0; | |
| 8155 | 538 | tempitem.wpn = 0; | |
| 8156 | 538 | tempitem.wpn2 = 0; | |
| 8157 | 538 | tempitem.wpn3 = 0; | |
| 8158 | 538 | tempitem.wpn4 = 0; | |
| 8159 | 538 | tempitem.wpn5 = 0; | |
| 8160 | 538 | tempitem.wpn6 = 0; | |
| 8161 | 538 | tempitem.wpn7 = 0; | |
| 8162 | 538 | tempitem.wpn8 = 0; | |
| 8163 | 538 | tempitem.wpn9 = 0; | |
| 8164 | 538 | tempitem.wpn10 = 0; | |
| 8165 | 538 | break; | |
| 8166 | } | ||
| 8167 | case itype_book: | ||
| 8168 | { | ||
| 8169 | 285 | tempitem.flags &= ~ (ITEM_FLAG2 | ITEM_FLAG3 | ITEM_FLAG4 | ITEM_FLAG5); | |
| 8170 | 285 | tempitem.misc1 = 0; | |
| 8171 | 285 | tempitem.misc2 = 0; | |
| 8172 | 285 | tempitem.misc3 = 0; | |
| 8173 | 285 | tempitem.misc4 = 0; | |
| 8174 | 285 | tempitem.misc5 = 0; | |
| 8175 | 285 | tempitem.misc6 = 0; | |
| 8176 | 285 | tempitem.misc7 = 0; | |
| 8177 | 285 | tempitem.misc8 = 0; | |
| 8178 | 285 | tempitem.misc9 = 0; | |
| 8179 | 285 | tempitem.misc10 = 0; | |
| 8180 | 285 | tempitem.wpn3 = 0; | |
| 8181 | 285 | tempitem.wpn4 = 0; | |
| 8182 | 285 | tempitem.wpn5 = 0; | |
| 8183 | 285 | tempitem.wpn6 = 0; | |
| 8184 | 285 | tempitem.wpn7 = 0; | |
| 8185 | 285 | tempitem.wpn8 = 0; | |
| 8186 | 285 | tempitem.wpn9 = 0; | |
| 8187 | 285 | tempitem.wpn10 = 0; | |
| 8188 | 285 | break; | |
| 8189 | } | ||
| 8190 | case itype_magickey: | ||
| 8191 | { | ||
| 8192 | 269 | tempitem.flags &= ~ (ITEM_FLAG2 | ITEM_FLAG3 | ITEM_FLAG4 | ITEM_FLAG5); | |
| 8193 | 269 | tempitem.misc1 = 0; | |
| 8194 | 269 | tempitem.misc2 = 0; | |
| 8195 | 269 | tempitem.misc3 = 0; | |
| 8196 | 269 | tempitem.misc4 = 0; | |
| 8197 | 269 | tempitem.misc5 = 0; | |
| 8198 | 269 | tempitem.misc6 = 0; | |
| 8199 | 269 | tempitem.misc7 = 0; | |
| 8200 | 269 | tempitem.misc8 = 0; | |
| 8201 | 269 | tempitem.misc9 = 0; | |
| 8202 | 269 | tempitem.misc10 = 0; | |
| 8203 | 269 | tempitem.wpn = 0; | |
| 8204 | 269 | tempitem.wpn2 = 0; | |
| 8205 | 269 | tempitem.wpn3 = 0; | |
| 8206 | 269 | tempitem.wpn4 = 0; | |
| 8207 | 269 | tempitem.wpn5 = 0; | |
| 8208 | 269 | tempitem.wpn6 = 0; | |
| 8209 | 269 | tempitem.wpn7 = 0; | |
| 8210 | 269 | tempitem.wpn8 = 0; | |
| 8211 | 269 | tempitem.wpn9 = 0; | |
| 8212 | 269 | tempitem.wpn10 = 0; | |
| 8213 | 269 | break; | |
| 8214 | } | ||
| 8215 | case itype_bracelet: | ||
| 8216 | { | ||
| 8217 | 813 | tempitem.flags &= ~ (ITEM_FLAG2 | ITEM_FLAG3 | ITEM_FLAG4 | ITEM_FLAG5); | |
| 8218 | 813 | tempitem.misc1 = 0; | |
| 8219 | 813 | tempitem.misc2 = 0; | |
| 8220 | 813 | tempitem.misc3 = 0; | |
| 8221 | 813 | tempitem.misc4 = 0; | |
| 8222 | 813 | tempitem.misc5 = 0; | |
| 8223 | 813 | tempitem.misc6 = 0; | |
| 8224 | 813 | tempitem.misc7 = 0; | |
| 8225 | 813 | tempitem.misc8 = 0; | |
| 8226 | 813 | tempitem.misc9 = 0; | |
| 8227 | 813 | tempitem.misc10 = 0; | |
| 8228 | 813 | tempitem.wpn = 0; | |
| 8229 | 813 | tempitem.wpn2 = 0; | |
| 8230 | 813 | tempitem.wpn3 = 0; | |
| 8231 | 813 | tempitem.wpn4 = 0; | |
| 8232 | 813 | tempitem.wpn5 = 0; | |
| 8233 | 813 | tempitem.wpn6 = 0; | |
| 8234 | 813 | tempitem.wpn7 = 0; | |
| 8235 | 813 | tempitem.wpn8 = 0; | |
| 8236 | 813 | tempitem.wpn9 = 0; | |
| 8237 | 813 | tempitem.wpn10 = 0; | |
| 8238 | 813 | break; | |
| 8239 | } | ||
| 8240 | case itype_flippers: | ||
| 8241 | { | ||
| 8242 | 271 | tempitem.flags &= ~ (ITEM_FLAG1 | ITEM_FLAG2 | ITEM_FLAG3 | ITEM_FLAG4 | ITEM_FLAG5); | |
| 8243 | 271 | tempitem.misc1 = 0; | |
| 8244 | 271 | tempitem.misc2 = 0; | |
| 8245 | 271 | tempitem.misc3 = 0; | |
| 8246 | 271 | tempitem.misc4 = 0; | |
| 8247 | 271 | tempitem.misc5 = 0; | |
| 8248 | 271 | tempitem.misc6 = 0; | |
| 8249 | 271 | tempitem.misc7 = 0; | |
| 8250 | 271 | tempitem.misc8 = 0; | |
| 8251 | 271 | tempitem.misc9 = 0; | |
| 8252 | 271 | tempitem.misc10 = 0; | |
| 8253 | 271 | tempitem.wpn = 0; | |
| 8254 | 271 | tempitem.wpn2 = 0; | |
| 8255 | 271 | tempitem.wpn3 = 0; | |
| 8256 | 271 | tempitem.wpn4 = 0; | |
| 8257 | 271 | tempitem.wpn5 = 0; | |
| 8258 | 271 | tempitem.wpn6 = 0; | |
| 8259 | 271 | tempitem.wpn7 = 0; | |
| 8260 | 271 | tempitem.wpn8 = 0; | |
| 8261 | 271 | tempitem.wpn9 = 0; | |
| 8262 | 271 | tempitem.wpn10 = 0; | |
| 8263 | 271 | break; | |
| 8264 | } | ||
| 8265 | case itype_boots: | ||
| 8266 | { | ||
| 8267 | 273 | tempitem.flags &= ~ (ITEM_FLAG2 | ITEM_FLAG3 | ITEM_FLAG4 | ITEM_FLAG5); | |
| 8268 | 273 | tempitem.misc1 = 0; | |
| 8269 | 273 | tempitem.misc2 = 0; | |
| 8270 | 273 | tempitem.misc3 = 0; | |
| 8271 | 273 | tempitem.misc4 = 0; | |
| 8272 | 273 | tempitem.misc5 = 0; | |
| 8273 | 273 | tempitem.misc6 = 0; | |
| 8274 | 273 | tempitem.misc7 = 0; | |
| 8275 | 273 | tempitem.misc8 = 0; | |
| 8276 | 273 | tempitem.misc9 = 0; | |
| 8277 | 273 | tempitem.misc10 = 0; | |
| 8278 | 273 | tempitem.wpn = 0; | |
| 8279 | 273 | tempitem.wpn2 = 0; | |
| 8280 | 273 | tempitem.wpn3 = 0; | |
| 8281 | 273 | tempitem.wpn4 = 0; | |
| 8282 | 273 | tempitem.wpn5 = 0; | |
| 8283 | 273 | tempitem.wpn6 = 0; | |
| 8284 | 273 | tempitem.wpn7 = 0; | |
| 8285 | 273 | tempitem.wpn8 = 0; | |
| 8286 | 273 | tempitem.wpn9 = 0; | |
| 8287 | 273 | tempitem.wpn10 = 0; | |
| 8288 | 273 | break; | |
| 8289 | } | ||
| 8290 | case itype_hookshot: | ||
| 8291 | { | ||
| 8292 | 540 | tempitem.flags &= ~ (ITEM_FLAG2 | ITEM_FLAG3 | ITEM_FLAG4 | ITEM_FLAG5); | |
| 8293 | 540 | tempitem.misc5 = 0; | |
| 8294 | 540 | tempitem.misc6 = 0; | |
| 8295 | 540 | tempitem.misc7 = 0; | |
| 8296 | 540 | tempitem.misc8 = 0; | |
| 8297 | 540 | tempitem.misc9 = 0; | |
| 8298 | 540 | tempitem.misc10 = 0; | |
| 8299 | 540 | tempitem.wpn5 = 0; | |
| 8300 | 540 | tempitem.wpn6 = 0; | |
| 8301 | 540 | tempitem.wpn7 = 0; | |
| 8302 | 540 | tempitem.wpn8 = 0; | |
| 8303 | 540 | tempitem.wpn9 = 0; | |
| 8304 | 540 | tempitem.wpn10 = 0; | |
| 8305 | 540 | break; | |
| 8306 | } | ||
| 8307 | case itype_lens: | ||
| 8308 | { | ||
| 8309 | 245 | tempitem.flags &= ~ (ITEM_FLAG1 | ITEM_FLAG2 | ITEM_FLAG3 | ITEM_FLAG4 | ITEM_FLAG5); | |
| 8310 | 245 | tempitem.misc2 = 0; | |
| 8311 | 245 | tempitem.misc3 = 0; | |
| 8312 | 245 | tempitem.misc4 = 0; | |
| 8313 | 245 | tempitem.misc5 = 0; | |
| 8314 | 245 | tempitem.misc6 = 0; | |
| 8315 | 245 | tempitem.misc7 = 0; | |
| 8316 | 245 | tempitem.misc8 = 0; | |
| 8317 | 245 | tempitem.misc9 = 0; | |
| 8318 | 245 | tempitem.misc10 = 0; | |
| 8319 | 245 | tempitem.wpn = 0; | |
| 8320 | 245 | tempitem.wpn2 = 0; | |
| 8321 | 245 | tempitem.wpn3 = 0; | |
| 8322 | 245 | tempitem.wpn4 = 0; | |
| 8323 | 245 | tempitem.wpn5 = 0; | |
| 8324 | 245 | tempitem.wpn6 = 0; | |
| 8325 | 245 | tempitem.wpn7 = 0; | |
| 8326 | 245 | tempitem.wpn8 = 0; | |
| 8327 | 245 | tempitem.wpn9 = 0; | |
| 8328 | 245 | tempitem.wpn10 = 0; | |
| 8329 | 245 | break; | |
| 8330 | } | ||
| 8331 | case itype_hammer: | ||
| 8332 | { | ||
| 8333 | 271 | tempitem.flags &= ~ (ITEM_FLAG1 | ITEM_FLAG2 | ITEM_FLAG3 | ITEM_FLAG4 | ITEM_FLAG5); | |
| 8334 | 271 | tempitem.misc1 = 0; | |
| 8335 | 271 | tempitem.misc2 = 0; | |
| 8336 | 271 | tempitem.misc3 = 0; | |
| 8337 | 271 | tempitem.misc4 = 0; | |
| 8338 | 271 | tempitem.misc5 = 0; | |
| 8339 | 271 | tempitem.misc6 = 0; | |
| 8340 | 271 | tempitem.misc7 = 0; | |
| 8341 | 271 | tempitem.misc8 = 0; | |
| 8342 | 271 | tempitem.misc9 = 0; | |
| 8343 | 271 | tempitem.misc10 = 0; | |
| 8344 | 271 | tempitem.wpn3 = 0; | |
| 8345 | 271 | tempitem.wpn4 = 0; | |
| 8346 | 271 | tempitem.wpn5 = 0; | |
| 8347 | 271 | tempitem.wpn6 = 0; | |
| 8348 | 271 | tempitem.wpn7 = 0; | |
| 8349 | 271 | tempitem.wpn8 = 0; | |
| 8350 | 271 | tempitem.wpn9 = 0; | |
| 8351 | 271 | tempitem.wpn10 = 0; | |
| 8352 | 271 | break; | |
| 8353 | } | ||
| 8354 | case itype_divinefire: | ||
| 8355 | { | ||
| 8356 | 269 | tempitem.flags &= ~ (ITEM_FLAG1 | ITEM_FLAG4 | ITEM_FLAG5); | |
| 8357 | 269 | tempitem.misc3 = 0; | |
| 8358 | 269 | tempitem.misc4 = 0; | |
| 8359 | 269 | tempitem.misc5 = 0; | |
| 8360 | 269 | tempitem.misc6 = 0; | |
| 8361 | 269 | tempitem.misc7 = 0; | |
| 8362 | 269 | tempitem.misc8 = 0; | |
| 8363 | 269 | tempitem.misc9 = 0; | |
| 8364 | 269 | tempitem.misc10 = 0; | |
| 8365 | 269 | tempitem.wpn6 = 0; | |
| 8366 | 269 | tempitem.wpn7 = 0; | |
| 8367 | 269 | tempitem.wpn8 = 0; | |
| 8368 | 269 | tempitem.wpn9 = 0; | |
| 8369 | 269 | tempitem.wpn10 = 0; | |
| 8370 | 269 | break; | |
| 8371 | } | ||
| 8372 | case itype_divineescape: | ||
| 8373 | { | ||
| 8374 | 269 | tempitem.flags &= ~ (ITEM_FLAG1 | ITEM_FLAG2 | ITEM_FLAG3 | ITEM_FLAG4 | ITEM_FLAG5); | |
| 8375 | 269 | tempitem.misc2 = 0; | |
| 8376 | 269 | tempitem.misc3 = 0; | |
| 8377 | 269 | tempitem.misc4 = 0; | |
| 8378 | 269 | tempitem.misc5 = 0; | |
| 8379 | 269 | tempitem.misc6 = 0; | |
| 8380 | 269 | tempitem.misc7 = 0; | |
| 8381 | 269 | tempitem.misc8 = 0; | |
| 8382 | 269 | tempitem.misc9 = 0; | |
| 8383 | 269 | tempitem.misc10 = 0; | |
| 8384 | 269 | tempitem.wpn = 0; | |
| 8385 | 269 | tempitem.wpn2 = 0; | |
| 8386 | 269 | tempitem.wpn3 = 0; | |
| 8387 | 269 | tempitem.wpn4 = 0; | |
| 8388 | 269 | tempitem.wpn5 = 0; | |
| 8389 | 269 | tempitem.wpn6 = 0; | |
| 8390 | 269 | tempitem.wpn7 = 0; | |
| 8391 | 269 | tempitem.wpn8 = 0; | |
| 8392 | 269 | tempitem.wpn9 = 0; | |
| 8393 | 269 | tempitem.wpn10 = 0; | |
| 8394 | 269 | break; | |
| 8395 | } | ||
| 8396 | case itype_divineprotection: | ||
| 8397 | { | ||
| 8398 | 269 | tempitem.flags &= ~ (ITEM_FLAG5); | |
| 8399 | 269 | tempitem.misc2 = 0; | |
| 8400 | 269 | tempitem.misc3 = 0; | |
| 8401 | 269 | tempitem.misc4 = 0; | |
| 8402 | 269 | tempitem.misc5 = 0; | |
| 8403 | 269 | tempitem.misc6 = 0; | |
| 8404 | 269 | tempitem.misc7 = 0; | |
| 8405 | 269 | tempitem.misc8 = 0; | |
| 8406 | 269 | tempitem.misc9 = 0; | |
| 8407 | 269 | tempitem.misc10 = 0; | |
| 8408 | 269 | break; | |
| 8409 | } | ||
| 8410 | case itype_bomb: | ||
| 8411 | { | ||
| 8412 | 285 | tempitem.flags &= ~ (ITEM_FLAG2 | ITEM_FLAG3 | ITEM_FLAG4 | ITEM_FLAG5); | |
| 8413 | 285 | tempitem.misc4 = 0; | |
| 8414 | 285 | tempitem.misc5 = 0; | |
| 8415 | 285 | tempitem.misc6 = 0; | |
| 8416 | 285 | tempitem.misc7 = 0; | |
| 8417 | 285 | tempitem.misc8 = 0; | |
| 8418 | 285 | tempitem.misc9 = 0; | |
| 8419 | 285 | tempitem.misc10 = 0; | |
| 8420 | 285 | tempitem.wpn3 = 0; | |
| 8421 | 285 | tempitem.wpn4 = 0; | |
| 8422 | 285 | tempitem.wpn5 = 0; | |
| 8423 | 285 | tempitem.wpn6 = 0; | |
| 8424 | 285 | tempitem.wpn7 = 0; | |
| 8425 | 285 | tempitem.wpn8 = 0; | |
| 8426 | 285 | tempitem.wpn9 = 0; | |
| 8427 | 285 | tempitem.wpn10 = 0; | |
| 8428 | 285 | break; | |
| 8429 | } | ||
| 8430 | case itype_sbomb: | ||
| 8431 | { | ||
| 8432 | 271 | tempitem.flags &= ~ (ITEM_FLAG1 | ITEM_FLAG2 | ITEM_FLAG3 | ITEM_FLAG4 | ITEM_FLAG5); | |
| 8433 | 271 | tempitem.misc4 = 0; | |
| 8434 | 271 | tempitem.misc5 = 0; | |
| 8435 | 271 | tempitem.misc6 = 0; | |
| 8436 | 271 | tempitem.misc7 = 0; | |
| 8437 | 271 | tempitem.misc8 = 0; | |
| 8438 | 271 | tempitem.misc9 = 0; | |
| 8439 | 271 | tempitem.misc10 = 0; | |
| 8440 | 271 | tempitem.wpn3 = 0; | |
| 8441 | 271 | tempitem.wpn4 = 0; | |
| 8442 | 271 | tempitem.wpn5 = 0; | |
| 8443 | 271 | tempitem.wpn6 = 0; | |
| 8444 | 271 | tempitem.wpn7 = 0; | |
| 8445 | 271 | tempitem.wpn8 = 0; | |
| 8446 | 271 | tempitem.wpn9 = 0; | |
| 8447 | 271 | tempitem.wpn10 = 0; | |
| 8448 | 271 | break; | |
| 8449 | } | ||
| 8450 | case itype_clock: | ||
| 8451 | { | ||
| 8452 | 271 | tempitem.flags &= ~ (ITEM_FLAG1 | ITEM_FLAG2 | ITEM_FLAG3 | ITEM_FLAG4 | ITEM_FLAG5); | |
| 8453 | 271 | tempitem.misc2 = 0; | |
| 8454 | 271 | tempitem.misc3 = 0; | |
| 8455 | 271 | tempitem.misc4 = 0; | |
| 8456 | 271 | tempitem.misc5 = 0; | |
| 8457 | 271 | tempitem.misc6 = 0; | |
| 8458 | 271 | tempitem.misc7 = 0; | |
| 8459 | 271 | tempitem.misc8 = 0; | |
| 8460 | 271 | tempitem.misc9 = 0; | |
| 8461 | 271 | tempitem.misc10 = 0; | |
| 8462 | 271 | tempitem.wpn = 0; | |
| 8463 | 271 | tempitem.wpn2 = 0; | |
| 8464 | 271 | tempitem.wpn3 = 0; | |
| 8465 | 271 | tempitem.wpn4 = 0; | |
| 8466 | 271 | tempitem.wpn5 = 0; | |
| 8467 | 271 | tempitem.wpn6 = 0; | |
| 8468 | 271 | tempitem.wpn7 = 0; | |
| 8469 | 271 | tempitem.wpn8 = 0; | |
| 8470 | 271 | tempitem.wpn9 = 0; | |
| 8471 | 271 | tempitem.wpn10 = 0; | |
| 8472 | 271 | break; | |
| 8473 | } | ||
| 8474 | case itype_key: | ||
| 8475 | { | ||
| 8476 | 269 | tempitem.flags &= ~ (ITEM_FLAG1 | ITEM_FLAG2 | ITEM_FLAG3 | ITEM_FLAG4 | ITEM_FLAG5); | |
| 8477 | 269 | tempitem.misc1 = 0; | |
| 8478 | 269 | tempitem.misc2 = 0; | |
| 8479 | 269 | tempitem.misc3 = 0; | |
| 8480 | 269 | tempitem.misc4 = 0; | |
| 8481 | 269 | tempitem.misc5 = 0; | |
| 8482 | 269 | tempitem.misc6 = 0; | |
| 8483 | 269 | tempitem.misc7 = 0; | |
| 8484 | 269 | tempitem.misc8 = 0; | |
| 8485 | 269 | tempitem.misc9 = 0; | |
| 8486 | 269 | tempitem.misc10 = 0; | |
| 8487 | 269 | tempitem.wpn = 0; | |
| 8488 | 269 | tempitem.wpn2 = 0; | |
| 8489 | 269 | tempitem.wpn3 = 0; | |
| 8490 | 269 | tempitem.wpn4 = 0; | |
| 8491 | 269 | tempitem.wpn5 = 0; | |
| 8492 | 269 | tempitem.wpn6 = 0; | |
| 8493 | 269 | tempitem.wpn7 = 0; | |
| 8494 | 269 | tempitem.wpn8 = 0; | |
| 8495 | 269 | tempitem.wpn9 = 0; | |
| 8496 | 269 | tempitem.wpn10 = 0; | |
| 8497 | 269 | break; | |
| 8498 | } | ||
| 8499 | case itype_magiccontainer: | ||
| 8500 | { | ||
| 8501 | 273 | tempitem.flags &= ~ (ITEM_FLAG1 | ITEM_FLAG2 | ITEM_FLAG3 | ITEM_FLAG4 | ITEM_FLAG5); | |
| 8502 | 273 | tempitem.misc1 = 0; | |
| 8503 | 273 | tempitem.misc2 = 0; | |
| 8504 | 273 | tempitem.misc3 = 0; | |
| 8505 | 273 | tempitem.misc4 = 0; | |
| 8506 | 273 | tempitem.misc5 = 0; | |
| 8507 | 273 | tempitem.misc6 = 0; | |
| 8508 | 273 | tempitem.misc7 = 0; | |
| 8509 | 273 | tempitem.misc8 = 0; | |
| 8510 | 273 | tempitem.misc9 = 0; | |
| 8511 | 273 | tempitem.misc10 = 0; | |
| 8512 | 273 | tempitem.wpn = 0; | |
| 8513 | 273 | tempitem.wpn2 = 0; | |
| 8514 | 273 | tempitem.wpn3 = 0; | |
| 8515 | 273 | tempitem.wpn4 = 0; | |
| 8516 | 273 | tempitem.wpn5 = 0; | |
| 8517 | 273 | tempitem.wpn6 = 0; | |
| 8518 | 273 | tempitem.wpn7 = 0; | |
| 8519 | 273 | tempitem.wpn8 = 0; | |
| 8520 | 273 | tempitem.wpn9 = 0; | |
| 8521 | 273 | tempitem.wpn10 = 0; | |
| 8522 | 273 | break; | |
| 8523 | } | ||
| 8524 | case itype_triforcepiece: | ||
| 8525 | { | ||
| 8526 | 538 | tempitem.flags &= ~ (ITEM_FLAG2 | ITEM_FLAG3 | ITEM_FLAG4 | ITEM_FLAG5); | |
| 8527 | 538 | tempitem.misc3 = 0; | |
| 8528 | 538 | tempitem.misc4 = 0; | |
| 8529 | 538 | tempitem.misc5 = 0; | |
| 8530 | 538 | tempitem.misc6 = 0; | |
| 8531 | 538 | tempitem.misc7 = 0; | |
| 8532 | 538 | tempitem.misc8 = 0; | |
| 8533 | 538 | tempitem.misc9 = 0; | |
| 8534 | 538 | tempitem.misc10 = 0; | |
| 8535 | 538 | tempitem.wpn = 0; | |
| 8536 | 538 | tempitem.wpn2 = 0; | |
| 8537 | 538 | tempitem.wpn3 = 0; | |
| 8538 | 538 | tempitem.wpn4 = 0; | |
| 8539 | 538 | tempitem.wpn5 = 0; | |
| 8540 | 538 | tempitem.wpn6 = 0; | |
| 8541 | 538 | tempitem.wpn7 = 0; | |
| 8542 | 538 | tempitem.wpn8 = 0; | |
| 8543 | 538 | tempitem.wpn9 = 0; | |
| 8544 | 538 | tempitem.wpn10 = 0; | |
| 8545 | 538 | break; | |
| 8546 | } | ||
| 8547 | case itype_map: case itype_compass: case itype_bosskey: | ||
| 8548 | { | ||
| 8549 | 811 | tempitem.flags &= ~ (ITEM_FLAG1 | ITEM_FLAG2 | ITEM_FLAG3 | ITEM_FLAG4 | ITEM_FLAG5); | |
| 8550 | 811 | tempitem.misc1 = 0; | |
| 8551 | 811 | tempitem.misc2 = 0; | |
| 8552 | 811 | tempitem.misc3 = 0; | |
| 8553 | 811 | tempitem.misc4 = 0; | |
| 8554 | 811 | tempitem.misc5 = 0; | |
| 8555 | 811 | tempitem.misc6 = 0; | |
| 8556 | 811 | tempitem.misc7 = 0; | |
| 8557 | 811 | tempitem.misc8 = 0; | |
| 8558 | 811 | tempitem.misc9 = 0; | |
| 8559 | 811 | tempitem.misc10 = 0; | |
| 8560 | 811 | tempitem.wpn = 0; | |
| 8561 | 811 | tempitem.wpn2 = 0; | |
| 8562 | 811 | tempitem.wpn3 = 0; | |
| 8563 | 811 | tempitem.wpn4 = 0; | |
| 8564 | 811 | tempitem.wpn5 = 0; | |
| 8565 | 811 | tempitem.wpn6 = 0; | |
| 8566 | 811 | tempitem.wpn7 = 0; | |
| 8567 | 811 | tempitem.wpn8 = 0; | |
| 8568 | 811 | tempitem.wpn9 = 0; | |
| 8569 | 811 | tempitem.wpn10 = 0; | |
| 8570 | 811 | break; | |
| 8571 | } | ||
| 8572 | case itype_quiver: | ||
| 8573 | { | ||
| 8574 | 1076 | tempitem.flags &= ~ (ITEM_FLAG1 | ITEM_FLAG2 | ITEM_FLAG3 | ITEM_FLAG4 | ITEM_FLAG5); | |
| 8575 | 1076 | tempitem.misc3 = 0; | |
| 8576 | 1076 | tempitem.misc4 = 0; | |
| 8577 | 1076 | tempitem.misc5 = 0; | |
| 8578 | 1076 | tempitem.misc6 = 0; | |
| 8579 | 1076 | tempitem.misc7 = 0; | |
| 8580 | 1076 | tempitem.misc8 = 0; | |
| 8581 | 1076 | tempitem.misc9 = 0; | |
| 8582 | 1076 | tempitem.misc10 = 0; | |
| 8583 | 1076 | tempitem.wpn = 0; | |
| 8584 | 1076 | tempitem.wpn2 = 0; | |
| 8585 | 1076 | tempitem.wpn3 = 0; | |
| 8586 | 1076 | tempitem.wpn4 = 0; | |
| 8587 | 1076 | tempitem.wpn5 = 0; | |
| 8588 | 1076 | tempitem.wpn6 = 0; | |
| 8589 | 1076 | tempitem.wpn7 = 0; | |
| 8590 | 1076 | tempitem.wpn8 = 0; | |
| 8591 | 1076 | tempitem.wpn9 = 0; | |
| 8592 | 1076 | tempitem.wpn10 = 0; | |
| 8593 | 1076 | break; | |
| 8594 | } | ||
| 8595 | case itype_lkey: | ||
| 8596 | { | ||
| 8597 | 759 | tempitem.flags &= ~ (ITEM_FLAG1 | ITEM_FLAG2 | ITEM_FLAG3 | ITEM_FLAG4 | ITEM_FLAG5); | |
| 8598 | 759 | tempitem.misc1 = 0; | |
| 8599 | 759 | tempitem.misc2 = 0; | |
| 8600 | 759 | tempitem.misc3 = 0; | |
| 8601 | 759 | tempitem.misc4 = 0; | |
| 8602 | 759 | tempitem.misc5 = 0; | |
| 8603 | 759 | tempitem.misc6 = 0; | |
| 8604 | 759 | tempitem.misc7 = 0; | |
| 8605 | 759 | tempitem.misc8 = 0; | |
| 8606 | 759 | tempitem.misc9 = 0; | |
| 8607 | 759 | tempitem.misc10 = 0; | |
| 8608 | 759 | tempitem.wpn = 0; | |
| 8609 | 759 | tempitem.wpn2 = 0; | |
| 8610 | 759 | tempitem.wpn3 = 0; | |
| 8611 | 759 | tempitem.wpn4 = 0; | |
| 8612 | 759 | tempitem.wpn5 = 0; | |
| 8613 | 759 | tempitem.wpn6 = 0; | |
| 8614 | 759 | tempitem.wpn7 = 0; | |
| 8615 | 759 | tempitem.wpn8 = 0; | |
| 8616 | 759 | tempitem.wpn9 = 0; | |
| 8617 | 759 | tempitem.wpn10 = 0; | |
| 8618 | 759 | break; | |
| 8619 | } | ||
| 8620 | case itype_cbyrna: | ||
| 8621 | { | ||
| 8622 | 269 | tempitem.flags &= ~ (ITEM_FLAG2 | ITEM_FLAG3 | ITEM_FLAG5); | |
| 8623 | 269 | tempitem.misc4 = 0; | |
| 8624 | 269 | tempitem.misc5 = 0; | |
| 8625 | 269 | tempitem.misc6 = 0; | |
| 8626 | 269 | tempitem.misc7 = 0; | |
| 8627 | 269 | tempitem.misc8 = 0; | |
| 8628 | 269 | tempitem.misc9 = 0; | |
| 8629 | 269 | tempitem.misc10 = 0; | |
| 8630 | 269 | tempitem.wpn6 = 0; | |
| 8631 | 269 | tempitem.wpn7 = 0; | |
| 8632 | 269 | tempitem.wpn8 = 0; | |
| 8633 | 269 | tempitem.wpn9 = 0; | |
| 8634 | 269 | tempitem.wpn10 = 0; | |
| 8635 | 269 | break; | |
| 8636 | } | ||
| 8637 | case itype_rupee: case itype_arrowammo: | ||
| 8638 | { | ||
| 8639 | 3150 | tempitem.flags &= ~ (ITEM_FLAG1 | ITEM_FLAG2 | ITEM_FLAG3 | ITEM_FLAG4 | ITEM_FLAG5); | |
| 8640 | 3150 | tempitem.misc1 = 0; | |
| 8641 | 3150 | tempitem.misc2 = 0; | |
| 8642 | 3150 | tempitem.misc3 = 0; | |
| 8643 | 3150 | tempitem.misc4 = 0; | |
| 8644 | 3150 | tempitem.misc5 = 0; | |
| 8645 | 3150 | tempitem.misc6 = 0; | |
| 8646 | 3150 | tempitem.misc7 = 0; | |
| 8647 | 3150 | tempitem.misc8 = 0; | |
| 8648 | 3150 | tempitem.misc9 = 0; | |
| 8649 | 3150 | tempitem.misc10 = 0; | |
| 8650 | 3150 | tempitem.wpn = 0; | |
| 8651 | 3150 | tempitem.wpn2 = 0; | |
| 8652 | 3150 | tempitem.wpn3 = 0; | |
| 8653 | 3150 | tempitem.wpn4 = 0; | |
| 8654 | 3150 | tempitem.wpn5 = 0; | |
| 8655 | 3150 | tempitem.wpn6 = 0; | |
| 8656 | 3150 | tempitem.wpn7 = 0; | |
| 8657 | 3150 | tempitem.wpn8 = 0; | |
| 8658 | 3150 | tempitem.wpn9 = 0; | |
| 8659 | 3150 | tempitem.wpn10 = 0; | |
| 8660 | 3150 | break; | |
| 8661 | } | ||
| 8662 | case itype_fairy: | ||
| 8663 | { | ||
| 8664 | 523 | tempitem.flags &= ~ (ITEM_FLAG3 | ITEM_FLAG4 | ITEM_FLAG5); | |
| 8665 | 523 | tempitem.misc4 = 0; | |
| 8666 | 523 | tempitem.misc5 = 0; | |
| 8667 | 523 | tempitem.misc6 = 0; | |
| 8668 | 523 | tempitem.misc7 = 0; | |
| 8669 | 523 | tempitem.misc8 = 0; | |
| 8670 | 523 | tempitem.misc9 = 0; | |
| 8671 | 523 | tempitem.misc10 = 0; | |
| 8672 | 523 | tempitem.wpn = 0; | |
| 8673 | 523 | tempitem.wpn2 = 0; | |
| 8674 | 523 | tempitem.wpn3 = 0; | |
| 8675 | 523 | tempitem.wpn4 = 0; | |
| 8676 | 523 | tempitem.wpn5 = 0; | |
| 8677 | 523 | tempitem.wpn6 = 0; | |
| 8678 | 523 | tempitem.wpn7 = 0; | |
| 8679 | 523 | tempitem.wpn8 = 0; | |
| 8680 | 523 | tempitem.wpn9 = 0; | |
| 8681 | 523 | tempitem.wpn10 = 0; | |
| 8682 | 523 | break; | |
| 8683 | } | ||
| 8684 | case itype_magic: case itype_heart: case itype_heartcontainer: case itype_heartpiece: case itype_killem: case itype_bombammo: | ||
| 8685 | { | ||
| 8686 | 2766 | tempitem.flags &= ~ (ITEM_FLAG1 | ITEM_FLAG2 | ITEM_FLAG3 | ITEM_FLAG4 | ITEM_FLAG5); | |
| 8687 | 2766 | tempitem.misc1 = 0; | |
| 8688 | 2766 | tempitem.misc2 = 0; | |
| 8689 | 2766 | tempitem.misc3 = 0; | |
| 8690 | 2766 | tempitem.misc4 = 0; | |
| 8691 | 2766 | tempitem.misc5 = 0; | |
| 8692 | 2766 | tempitem.misc6 = 0; | |
| 8693 | 2766 | tempitem.misc7 = 0; | |
| 8694 | 2766 | tempitem.misc8 = 0; | |
| 8695 | 2766 | tempitem.misc9 = 0; | |
| 8696 | 2766 | tempitem.misc10 = 0; | |
| 8697 | 2766 | tempitem.wpn = 0; | |
| 8698 | 2766 | tempitem.wpn2 = 0; | |
| 8699 | 2766 | tempitem.wpn3 = 0; | |
| 8700 | 2766 | tempitem.wpn4 = 0; | |
| 8701 | 2766 | tempitem.wpn5 = 0; | |
| 8702 | 2766 | tempitem.wpn6 = 0; | |
| 8703 | 2766 | tempitem.wpn7 = 0; | |
| 8704 | 2766 | tempitem.wpn8 = 0; | |
| 8705 | 2766 | tempitem.wpn9 = 0; | |
| 8706 | 2766 | tempitem.wpn10 = 0; | |
| 8707 | 2766 | break; | |
| 8708 | } | ||
| 8709 | case itype_bombbag: | ||
| 8710 | { | ||
| 8711 | 1076 | tempitem.flags &= ~ (ITEM_FLAG2 | ITEM_FLAG3 | ITEM_FLAG4 | ITEM_FLAG5); | |
| 8712 | 1076 | tempitem.misc3 = 0; | |
| 8713 | 1076 | tempitem.misc4 = 0; | |
| 8714 | 1076 | tempitem.misc5 = 0; | |
| 8715 | 1076 | tempitem.misc6 = 0; | |
| 8716 | 1076 | tempitem.misc7 = 0; | |
| 8717 | 1076 | tempitem.misc8 = 0; | |
| 8718 | 1076 | tempitem.misc9 = 0; | |
| 8719 | 1076 | tempitem.misc10 = 0; | |
| 8720 | 1076 | tempitem.wpn = 0; | |
| 8721 | 1076 | tempitem.wpn2 = 0; | |
| 8722 | 1076 | tempitem.wpn3 = 0; | |
| 8723 | 1076 | tempitem.wpn4 = 0; | |
| 8724 | 1076 | tempitem.wpn5 = 0; | |
| 8725 | 1076 | tempitem.wpn6 = 0; | |
| 8726 | 1076 | tempitem.wpn7 = 0; | |
| 8727 | 1076 | tempitem.wpn8 = 0; | |
| 8728 | 1076 | tempitem.wpn9 = 0; | |
| 8729 | 1076 | tempitem.wpn10 = 0; | |
| 8730 | 1076 | break; | |
| 8731 | } | ||
| 8732 | case itype_rocs: | ||
| 8733 | { | ||
| 8734 | 269 | tempitem.flags &= ~ (ITEM_FLAG1 | ITEM_FLAG2 | ITEM_FLAG3 | ITEM_FLAG4 | ITEM_FLAG5); | |
| 8735 | 269 | tempitem.misc1 = 0; | |
| 8736 | 269 | tempitem.misc2 = 0; | |
| 8737 | 269 | tempitem.misc3 = 0; | |
| 8738 | 269 | tempitem.misc4 = 0; | |
| 8739 | 269 | tempitem.misc5 = 0; | |
| 8740 | 269 | tempitem.misc6 = 0; | |
| 8741 | 269 | tempitem.misc7 = 0; | |
| 8742 | 269 | tempitem.misc8 = 0; | |
| 8743 | 269 | tempitem.misc9 = 0; | |
| 8744 | 269 | tempitem.misc10 = 0; | |
| 8745 | 269 | tempitem.wpn = 0; | |
| 8746 | 269 | tempitem.wpn2 = 0; | |
| 8747 | 269 | tempitem.wpn3 = 0; | |
| 8748 | 269 | tempitem.wpn4 = 0; | |
| 8749 | 269 | tempitem.wpn5 = 0; | |
| 8750 | 269 | tempitem.wpn6 = 0; | |
| 8751 | 269 | tempitem.wpn7 = 0; | |
| 8752 | 269 | tempitem.wpn8 = 0; | |
| 8753 | 269 | tempitem.wpn9 = 0; | |
| 8754 | 269 | tempitem.wpn10 = 0; | |
| 8755 | 269 | break; | |
| 8756 | } | ||
| 8757 | case itype_hoverboots: | ||
| 8758 | { | ||
| 8759 | 269 | tempitem.flags &= ~ (ITEM_FLAG1 | ITEM_FLAG2 | ITEM_FLAG3 | ITEM_FLAG4 | ITEM_FLAG5); | |
| 8760 | 269 | tempitem.misc2 = 0; | |
| 8761 | 269 | tempitem.misc3 = 0; | |
| 8762 | 269 | tempitem.misc4 = 0; | |
| 8763 | 269 | tempitem.misc5 = 0; | |
| 8764 | 269 | tempitem.misc6 = 0; | |
| 8765 | 269 | tempitem.misc7 = 0; | |
| 8766 | 269 | tempitem.misc8 = 0; | |
| 8767 | 269 | tempitem.misc9 = 0; | |
| 8768 | 269 | tempitem.misc10 = 0; | |
| 8769 | 269 | tempitem.wpn2 = 0; | |
| 8770 | 269 | tempitem.wpn3 = 0; | |
| 8771 | 269 | tempitem.wpn4 = 0; | |
| 8772 | 269 | tempitem.wpn5 = 0; | |
| 8773 | 269 | tempitem.wpn6 = 0; | |
| 8774 | 269 | tempitem.wpn7 = 0; | |
| 8775 | 269 | tempitem.wpn8 = 0; | |
| 8776 | 269 | tempitem.wpn9 = 0; | |
| 8777 | 269 | tempitem.wpn10 = 0; | |
| 8778 | 269 | break; | |
| 8779 | } | ||
| 8780 | case itype_spinscroll: | ||
| 8781 | { | ||
| 8782 | 269 | tempitem.flags &= ~ (ITEM_FLAG1 | ITEM_FLAG2 | ITEM_FLAG3 | ITEM_FLAG4 | ITEM_FLAG5); | |
| 8783 | 269 | tempitem.misc2 = 0; | |
| 8784 | 269 | tempitem.misc3 = 0; | |
| 8785 | 269 | tempitem.misc4 = 0; | |
| 8786 | 269 | tempitem.misc5 = 0; | |
| 8787 | 269 | tempitem.misc6 = 0; | |
| 8788 | 269 | tempitem.misc7 = 0; | |
| 8789 | 269 | tempitem.misc8 = 0; | |
| 8790 | 269 | tempitem.misc9 = 0; | |
| 8791 | 269 | tempitem.misc10 = 0; | |
| 8792 | 269 | tempitem.wpn = 0; | |
| 8793 | 269 | tempitem.wpn2 = 0; | |
| 8794 | 269 | tempitem.wpn3 = 0; | |
| 8795 | 269 | tempitem.wpn4 = 0; | |
| 8796 | 269 | tempitem.wpn5 = 0; | |
| 8797 | 269 | tempitem.wpn6 = 0; | |
| 8798 | 269 | tempitem.wpn7 = 0; | |
| 8799 | 269 | tempitem.wpn8 = 0; | |
| 8800 | 269 | tempitem.wpn9 = 0; | |
| 8801 | 269 | tempitem.wpn10 = 0; | |
| 8802 | 269 | break; | |
| 8803 | } | ||
| 8804 | case itype_crossscroll: | ||
| 8805 | { | ||
| 8806 | 269 | tempitem.flags &= ~ (ITEM_FLAG1 | ITEM_FLAG2 | ITEM_FLAG3 | ITEM_FLAG4 | ITEM_FLAG5); | |
| 8807 | 269 | tempitem.misc1 = 0; | |
| 8808 | 269 | tempitem.misc2 = 0; | |
| 8809 | 269 | tempitem.misc3 = 0; | |
| 8810 | 269 | tempitem.misc4 = 0; | |
| 8811 | 269 | tempitem.misc5 = 0; | |
| 8812 | 269 | tempitem.misc6 = 0; | |
| 8813 | 269 | tempitem.misc7 = 0; | |
| 8814 | 269 | tempitem.misc8 = 0; | |
| 8815 | 269 | tempitem.misc9 = 0; | |
| 8816 | 269 | tempitem.misc10 = 0; | |
| 8817 | 269 | tempitem.wpn = 0; | |
| 8818 | 269 | tempitem.wpn2 = 0; | |
| 8819 | 269 | tempitem.wpn3 = 0; | |
| 8820 | 269 | tempitem.wpn4 = 0; | |
| 8821 | 269 | tempitem.wpn5 = 0; | |
| 8822 | 269 | tempitem.wpn6 = 0; | |
| 8823 | 269 | tempitem.wpn7 = 0; | |
| 8824 | 269 | tempitem.wpn8 = 0; | |
| 8825 | 269 | tempitem.wpn9 = 0; | |
| 8826 | 269 | tempitem.wpn10 = 0; | |
| 8827 | 269 | break; | |
| 8828 | } | ||
| 8829 | case itype_quakescroll: | ||
| 8830 | { | ||
| 8831 | 269 | tempitem.flags &= ~ (ITEM_FLAG1 | ITEM_FLAG2 | ITEM_FLAG3 | ITEM_FLAG4 | ITEM_FLAG5); | |
| 8832 | 269 | tempitem.misc3 = 0; | |
| 8833 | 269 | tempitem.misc4 = 0; | |
| 8834 | 269 | tempitem.misc5 = 0; | |
| 8835 | 269 | tempitem.misc6 = 0; | |
| 8836 | 269 | tempitem.misc7 = 0; | |
| 8837 | 269 | tempitem.misc8 = 0; | |
| 8838 | 269 | tempitem.misc9 = 0; | |
| 8839 | 269 | tempitem.misc10 = 0; | |
| 8840 | 269 | tempitem.wpn = 0; | |
| 8841 | 269 | tempitem.wpn2 = 0; | |
| 8842 | 269 | tempitem.wpn3 = 0; | |
| 8843 | 269 | tempitem.wpn4 = 0; | |
| 8844 | 269 | tempitem.wpn5 = 0; | |
| 8845 | 269 | tempitem.wpn6 = 0; | |
| 8846 | 269 | tempitem.wpn7 = 0; | |
| 8847 | 269 | tempitem.wpn8 = 0; | |
| 8848 | 269 | tempitem.wpn9 = 0; | |
| 8849 | 269 | tempitem.wpn10 = 0; | |
| 8850 | 269 | break; | |
| 8851 | } | ||
| 8852 | case itype_whispring: | ||
| 8853 | { | ||
| 8854 | 540 | tempitem.flags &= ~ (ITEM_FLAG2 | ITEM_FLAG3 | ITEM_FLAG4 | ITEM_FLAG5); | |
| 8855 | 540 | tempitem.misc2 = 0; | |
| 8856 | 540 | tempitem.misc3 = 0; | |
| 8857 | 540 | tempitem.misc4 = 0; | |
| 8858 | 540 | tempitem.misc5 = 0; | |
| 8859 | 540 | tempitem.misc6 = 0; | |
| 8860 | 540 | tempitem.misc7 = 0; | |
| 8861 | 540 | tempitem.misc8 = 0; | |
| 8862 | 540 | tempitem.misc9 = 0; | |
| 8863 | 540 | tempitem.misc10 = 0; | |
| 8864 | 540 | tempitem.wpn = 0; | |
| 8865 | 540 | tempitem.wpn2 = 0; | |
| 8866 | 540 | tempitem.wpn3 = 0; | |
| 8867 | 540 | tempitem.wpn4 = 0; | |
| 8868 | 540 | tempitem.wpn5 = 0; | |
| 8869 | 540 | tempitem.wpn6 = 0; | |
| 8870 | 540 | tempitem.wpn7 = 0; | |
| 8871 | 540 | tempitem.wpn8 = 0; | |
| 8872 | 540 | tempitem.wpn9 = 0; | |
| 8873 | 540 | tempitem.wpn10 = 0; | |
| 8874 | 540 | break; | |
| 8875 | } | ||
| 8876 | case itype_chargering: | ||
| 8877 | { | ||
| 8878 | 538 | tempitem.flags &= ~ (ITEM_FLAG1 | ITEM_FLAG2 | ITEM_FLAG3 | ITEM_FLAG4 | ITEM_FLAG5); | |
| 8879 | 538 | tempitem.misc3 = 0; | |
| 8880 | 538 | tempitem.misc4 = 0; | |
| 8881 | 538 | tempitem.misc5 = 0; | |
| 8882 | 538 | tempitem.misc6 = 0; | |
| 8883 | 538 | tempitem.misc7 = 0; | |
| 8884 | 538 | tempitem.misc8 = 0; | |
| 8885 | 538 | tempitem.misc9 = 0; | |
| 8886 | 538 | tempitem.misc10 = 0; | |
| 8887 | 538 | tempitem.wpn = 0; | |
| 8888 | 538 | tempitem.wpn2 = 0; | |
| 8889 | 538 | tempitem.wpn3 = 0; | |
| 8890 | 538 | tempitem.wpn4 = 0; | |
| 8891 | 538 | tempitem.wpn5 = 0; | |
| 8892 | 538 | tempitem.wpn6 = 0; | |
| 8893 | 538 | tempitem.wpn7 = 0; | |
| 8894 | 538 | tempitem.wpn8 = 0; | |
| 8895 | 538 | tempitem.wpn9 = 0; | |
| 8896 | 538 | tempitem.wpn10 = 0; | |
| 8897 | 538 | break; | |
| 8898 | } | ||
| 8899 | case itype_perilscroll: | ||
| 8900 | { | ||
| 8901 | 269 | tempitem.flags &= ~ (ITEM_FLAG1 | ITEM_FLAG2 | ITEM_FLAG3 | ITEM_FLAG4 | ITEM_FLAG5); | |
| 8902 | 269 | tempitem.misc2 = 0; | |
| 8903 | 269 | tempitem.misc3 = 0; | |
| 8904 | 269 | tempitem.misc4 = 0; | |
| 8905 | 269 | tempitem.misc5 = 0; | |
| 8906 | 269 | tempitem.misc6 = 0; | |
| 8907 | 269 | tempitem.misc7 = 0; | |
| 8908 | 269 | tempitem.misc8 = 0; | |
| 8909 | 269 | tempitem.misc9 = 0; | |
| 8910 | 269 | tempitem.misc10 = 0; | |
| 8911 | 269 | tempitem.wpn = 0; | |
| 8912 | 269 | tempitem.wpn2 = 0; | |
| 8913 | 269 | tempitem.wpn3 = 0; | |
| 8914 | 269 | tempitem.wpn4 = 0; | |
| 8915 | 269 | tempitem.wpn5 = 0; | |
| 8916 | 269 | tempitem.wpn6 = 0; | |
| 8917 | 269 | tempitem.wpn7 = 0; | |
| 8918 | 269 | tempitem.wpn8 = 0; | |
| 8919 | 269 | tempitem.wpn9 = 0; | |
| 8920 | 269 | tempitem.wpn10 = 0; | |
| 8921 | 269 | break; | |
| 8922 | } | ||
| 8923 | case itype_wealthmedal: | ||
| 8924 | { | ||
| 8925 | 809 | tempitem.flags &= ~ (ITEM_FLAG2 | ITEM_FLAG3 | ITEM_FLAG4 | ITEM_FLAG5); | |
| 8926 | 809 | tempitem.misc2 = 0; | |
| 8927 | 809 | tempitem.misc3 = 0; | |
| 8928 | 809 | tempitem.misc4 = 0; | |
| 8929 | 809 | tempitem.misc5 = 0; | |
| 8930 | 809 | tempitem.misc6 = 0; | |
| 8931 | 809 | tempitem.misc7 = 0; | |
| 8932 | 809 | tempitem.misc8 = 0; | |
| 8933 | 809 | tempitem.misc9 = 0; | |
| 8934 | 809 | tempitem.misc10 = 0; | |
| 8935 | 809 | tempitem.wpn = 0; | |
| 8936 | 809 | tempitem.wpn2 = 0; | |
| 8937 | 809 | tempitem.wpn3 = 0; | |
| 8938 | 809 | tempitem.wpn4 = 0; | |
| 8939 | 809 | tempitem.wpn5 = 0; | |
| 8940 | 809 | tempitem.wpn6 = 0; | |
| 8941 | 809 | tempitem.wpn7 = 0; | |
| 8942 | 809 | tempitem.wpn8 = 0; | |
| 8943 | 809 | tempitem.wpn9 = 0; | |
| 8944 | 809 | tempitem.wpn10 = 0; | |
| 8945 | 809 | break; | |
| 8946 | } | ||
| 8947 | case itype_heartring: | ||
| 8948 | { | ||
| 8949 | 811 | tempitem.flags &= ~ (ITEM_FLAG1 | ITEM_FLAG2 | ITEM_FLAG3 | ITEM_FLAG4 | ITEM_FLAG5); | |
| 8950 | 811 | tempitem.misc3 = 0; | |
| 8951 | 811 | tempitem.misc4 = 0; | |
| 8952 | 811 | tempitem.misc5 = 0; | |
| 8953 | 811 | tempitem.misc6 = 0; | |
| 8954 | 811 | tempitem.misc7 = 0; | |
| 8955 | 811 | tempitem.misc8 = 0; | |
| 8956 | 811 | tempitem.misc9 = 0; | |
| 8957 | 811 | tempitem.misc10 = 0; | |
| 8958 | 811 | tempitem.wpn = 0; | |
| 8959 | 811 | tempitem.wpn2 = 0; | |
| 8960 | 811 | tempitem.wpn3 = 0; | |
| 8961 | 811 | tempitem.wpn4 = 0; | |
| 8962 | 811 | tempitem.wpn5 = 0; | |
| 8963 | 811 | tempitem.wpn6 = 0; | |
| 8964 | 811 | tempitem.wpn7 = 0; | |
| 8965 | 811 | tempitem.wpn8 = 0; | |
| 8966 | 811 | tempitem.wpn9 = 0; | |
| 8967 | 811 | tempitem.wpn10 = 0; | |
| 8968 | 811 | break; | |
| 8969 | } | ||
| 8970 | case itype_magicring: | ||
| 8971 | { | ||
| 8972 | 1084 | tempitem.flags &= ~ (ITEM_FLAG1 | ITEM_FLAG2 | ITEM_FLAG3 | ITEM_FLAG4 | ITEM_FLAG5); | |
| 8973 | 1084 | tempitem.misc3 = 0; | |
| 8974 | 1084 | tempitem.misc4 = 0; | |
| 8975 | 1084 | tempitem.misc5 = 0; | |
| 8976 | 1084 | tempitem.misc6 = 0; | |
| 8977 | 1084 | tempitem.misc7 = 0; | |
| 8978 | 1084 | tempitem.misc8 = 0; | |
| 8979 | 1084 | tempitem.misc9 = 0; | |
| 8980 | 1084 | tempitem.misc10 = 0; | |
| 8981 | 1084 | tempitem.wpn = 0; | |
| 8982 | 1084 | tempitem.wpn2 = 0; | |
| 8983 | 1084 | tempitem.wpn3 = 0; | |
| 8984 | 1084 | tempitem.wpn4 = 0; | |
| 8985 | 1084 | tempitem.wpn5 = 0; | |
| 8986 | 1084 | tempitem.wpn6 = 0; | |
| 8987 | 1084 | tempitem.wpn7 = 0; | |
| 8988 | 1084 | tempitem.wpn8 = 0; | |
| 8989 | 1084 | tempitem.wpn9 = 0; | |
| 8990 | 1084 | tempitem.wpn10 = 0; | |
| 8991 | 1084 | break; | |
| 8992 | } | ||
| 8993 | case itype_spinscroll2: | ||
| 8994 | { | ||
| 8995 | 269 | tempitem.flags &= ~ (ITEM_FLAG1 | ITEM_FLAG2 | ITEM_FLAG3 | ITEM_FLAG4 | ITEM_FLAG5); | |
| 8996 | 269 | tempitem.misc2 = 0; | |
| 8997 | 269 | tempitem.misc3 = 0; | |
| 8998 | 269 | tempitem.misc4 = 0; | |
| 8999 | 269 | tempitem.misc5 = 0; | |
| 9000 | 269 | tempitem.misc6 = 0; | |
| 9001 | 269 | tempitem.misc7 = 0; | |
| 9002 | 269 | tempitem.misc8 = 0; | |
| 9003 | 269 | tempitem.misc9 = 0; | |
| 9004 | 269 | tempitem.misc10 = 0; | |
| 9005 | 269 | tempitem.wpn = 0; | |
| 9006 | 269 | tempitem.wpn2 = 0; | |
| 9007 | 269 | tempitem.wpn3 = 0; | |
| 9008 | 269 | tempitem.wpn4 = 0; | |
| 9009 | 269 | tempitem.wpn5 = 0; | |
| 9010 | 269 | tempitem.wpn6 = 0; | |
| 9011 | 269 | tempitem.wpn7 = 0; | |
| 9012 | 269 | tempitem.wpn8 = 0; | |
| 9013 | 269 | tempitem.wpn9 = 0; | |
| 9014 | 269 | tempitem.wpn10 = 0; | |
| 9015 | 269 | break; | |
| 9016 | } | ||
| 9017 | case itype_quakescroll2: | ||
| 9018 | { | ||
| 9019 | 269 | tempitem.flags &= ~ (ITEM_FLAG1 | ITEM_FLAG2 | ITEM_FLAG3 | ITEM_FLAG4 | ITEM_FLAG5); | |
| 9020 | 269 | tempitem.misc3 = 0; | |
| 9021 | 269 | tempitem.misc4 = 0; | |
| 9022 | 269 | tempitem.misc5 = 0; | |
| 9023 | 269 | tempitem.misc6 = 0; | |
| 9024 | 269 | tempitem.misc7 = 0; | |
| 9025 | 269 | tempitem.misc8 = 0; | |
| 9026 | 269 | tempitem.misc9 = 0; | |
| 9027 | 269 | tempitem.misc10 = 0; | |
| 9028 | 269 | tempitem.wpn = 0; | |
| 9029 | 269 | tempitem.wpn2 = 0; | |
| 9030 | 269 | tempitem.wpn3 = 0; | |
| 9031 | 269 | tempitem.wpn4 = 0; | |
| 9032 | 269 | tempitem.wpn5 = 0; | |
| 9033 | 269 | tempitem.wpn6 = 0; | |
| 9034 | 269 | tempitem.wpn7 = 0; | |
| 9035 | 269 | tempitem.wpn8 = 0; | |
| 9036 | 269 | tempitem.wpn9 = 0; | |
| 9037 | 269 | tempitem.wpn10 = 0; | |
| 9038 | 269 | break; | |
| 9039 | } | ||
| 9040 | case itype_agony: | ||
| 9041 | { | ||
| 9042 | 269 | tempitem.flags &= ~ (ITEM_FLAG1 | ITEM_FLAG2 | ITEM_FLAG3 | ITEM_FLAG4 | ITEM_FLAG5); | |
| 9043 | 269 | tempitem.misc2 = 0; | |
| 9044 | 269 | tempitem.misc3 = 0; | |
| 9045 | 269 | tempitem.misc4 = 0; | |
| 9046 | 269 | tempitem.misc5 = 0; | |
| 9047 | 269 | tempitem.misc6 = 0; | |
| 9048 | 269 | tempitem.misc7 = 0; | |
| 9049 | 269 | tempitem.misc8 = 0; | |
| 9050 | 269 | tempitem.misc9 = 0; | |
| 9051 | 269 | tempitem.misc10 = 0; | |
| 9052 | 269 | tempitem.wpn = 0; | |
| 9053 | 269 | tempitem.wpn2 = 0; | |
| 9054 | 269 | tempitem.wpn3 = 0; | |
| 9055 | 269 | tempitem.wpn4 = 0; | |
| 9056 | 269 | tempitem.wpn5 = 0; | |
| 9057 | 269 | tempitem.wpn6 = 0; | |
| 9058 | 269 | tempitem.wpn7 = 0; | |
| 9059 | 269 | tempitem.wpn8 = 0; | |
| 9060 | 269 | tempitem.wpn9 = 0; | |
| 9061 | 269 | tempitem.wpn10 = 0; | |
| 9062 | 269 | break; | |
| 9063 | } | ||
| 9064 | case itype_stompboots: | ||
| 9065 | { | ||
| 9066 | 269 | tempitem.flags &= ~ (ITEM_FLAG1 | ITEM_FLAG2 | ITEM_FLAG3 | ITEM_FLAG4 | ITEM_FLAG5); | |
| 9067 | 269 | tempitem.misc1 = 0; | |
| 9068 | 269 | tempitem.misc2 = 0; | |
| 9069 | 269 | tempitem.misc3 = 0; | |
| 9070 | 269 | tempitem.misc4 = 0; | |
| 9071 | 269 | tempitem.misc5 = 0; | |
| 9072 | 269 | tempitem.misc6 = 0; | |
| 9073 | 269 | tempitem.misc7 = 0; | |
| 9074 | 269 | tempitem.misc8 = 0; | |
| 9075 | 269 | tempitem.misc9 = 0; | |
| 9076 | 269 | tempitem.misc10 = 0; | |
| 9077 | 269 | tempitem.wpn = 0; | |
| 9078 | 269 | tempitem.wpn2 = 0; | |
| 9079 | 269 | tempitem.wpn3 = 0; | |
| 9080 | 269 | tempitem.wpn4 = 0; | |
| 9081 | 269 | tempitem.wpn5 = 0; | |
| 9082 | 269 | tempitem.wpn6 = 0; | |
| 9083 | 269 | tempitem.wpn7 = 0; | |
| 9084 | 269 | tempitem.wpn8 = 0; | |
| 9085 | 269 | tempitem.wpn9 = 0; | |
| 9086 | 269 | tempitem.wpn10 = 0; | |
| 9087 | 269 | break; | |
| 9088 | } | ||
| 9089 | case itype_whimsicalring: | ||
| 9090 | { | ||
| 9091 | 269 | tempitem.flags &= ~ (ITEM_FLAG1 | ITEM_FLAG2 | ITEM_FLAG3 | ITEM_FLAG4 | ITEM_FLAG5); | |
| 9092 | 269 | tempitem.misc2 = 0; | |
| 9093 | 269 | tempitem.misc3 = 0; | |
| 9094 | 269 | tempitem.misc4 = 0; | |
| 9095 | 269 | tempitem.misc5 = 0; | |
| 9096 | 269 | tempitem.misc6 = 0; | |
| 9097 | 269 | tempitem.misc7 = 0; | |
| 9098 | 269 | tempitem.misc8 = 0; | |
| 9099 | 269 | tempitem.misc9 = 0; | |
| 9100 | 269 | tempitem.misc10 = 0; | |
| 9101 | 269 | tempitem.wpn = 0; | |
| 9102 | 269 | tempitem.wpn2 = 0; | |
| 9103 | 269 | tempitem.wpn3 = 0; | |
| 9104 | 269 | tempitem.wpn4 = 0; | |
| 9105 | 269 | tempitem.wpn5 = 0; | |
| 9106 | 269 | tempitem.wpn6 = 0; | |
| 9107 | 269 | tempitem.wpn7 = 0; | |
| 9108 | 269 | tempitem.wpn8 = 0; | |
| 9109 | 269 | tempitem.wpn9 = 0; | |
| 9110 | 269 | tempitem.wpn10 = 0; | |
| 9111 | 269 | break; | |
| 9112 | } | ||
| 9113 | case itype_perilring: | ||
| 9114 | { | ||
| 9115 | 295 | tempitem.flags &= ~ (ITEM_FLAG1 | ITEM_FLAG2 | ITEM_FLAG3 | ITEM_FLAG4 | ITEM_FLAG5); | |
| 9116 | 295 | tempitem.misc2 = 0; | |
| 9117 | 295 | tempitem.misc3 = 0; | |
| 9118 | 295 | tempitem.misc4 = 0; | |
| 9119 | 295 | tempitem.misc5 = 0; | |
| 9120 | 295 | tempitem.misc6 = 0; | |
| 9121 | 295 | tempitem.misc7 = 0; | |
| 9122 | 295 | tempitem.misc8 = 0; | |
| 9123 | 295 | tempitem.misc9 = 0; | |
| 9124 | 295 | tempitem.misc10 = 0; | |
| 9125 | 295 | tempitem.wpn = 0; | |
| 9126 | 295 | tempitem.wpn2 = 0; | |
| 9127 | 295 | tempitem.wpn3 = 0; | |
| 9128 | 295 | tempitem.wpn4 = 0; | |
| 9129 | 295 | tempitem.wpn5 = 0; | |
| 9130 | 295 | tempitem.wpn6 = 0; | |
| 9131 | 295 | tempitem.wpn7 = 0; | |
| 9132 | 295 | tempitem.wpn8 = 0; | |
| 9133 | 295 | tempitem.wpn9 = 0; | |
| 9134 | 295 | tempitem.wpn10 = 0; | |
| 9135 | 295 | break; | |
| 9136 | } | ||
| 9137 | case itype_custom1: case itype_custom2: case itype_custom3: case itype_custom4: case itype_custom5: | ||
| 9138 | case itype_custom6: case itype_custom7: case itype_custom8: case itype_custom9: case itype_custom10: | ||
| 9139 | case itype_custom11: case itype_custom12: case itype_custom13: case itype_custom14: case itype_custom15: | ||
| 9140 | case itype_custom16: case itype_custom17: case itype_custom18: case itype_custom19: case itype_custom20: | ||
| 9141 | case itype_bowandarrow: case itype_letterpotion: case itype_misc: | ||
| 9142 | { | ||
| 9143 | 9413 | tempitem.flags &= ~ (ITEM_FLAG1 | ITEM_FLAG2 | ITEM_FLAG3 | ITEM_FLAG4 | ITEM_FLAG5); | |
| 9144 | 9413 | tempitem.misc1 = 0; | |
| 9145 | 9413 | tempitem.misc2 = 0; | |
| 9146 | 9413 | tempitem.misc3 = 0; | |
| 9147 | 9413 | tempitem.misc4 = 0; | |
| 9148 | 9413 | tempitem.misc5 = 0; | |
| 9149 | 9413 | tempitem.misc6 = 0; | |
| 9150 | 9413 | tempitem.misc7 = 0; | |
| 9151 | 9413 | tempitem.misc8 = 0; | |
| 9152 | 9413 | tempitem.misc9 = 0; | |
| 9153 | 9413 | tempitem.misc10 = 0; | |
| 9154 | 9413 | tempitem.wpn = 0; | |
| 9155 | 9413 | tempitem.wpn2 = 0; | |
| 9156 | 9413 | tempitem.wpn3 = 0; | |
| 9157 | 9413 | tempitem.wpn4 = 0; | |
| 9158 | 9413 | tempitem.wpn5 = 0; | |
| 9159 | 9413 | tempitem.wpn6 = 0; | |
| 9160 | 9413 | tempitem.wpn7 = 0; | |
| 9161 | 9413 | tempitem.wpn8 = 0; | |
| 9162 | 9413 | tempitem.wpn9 = 0; | |
| 9163 | 9413 | tempitem.wpn10 = 0; | |
| 9164 | 9413 | break; | |
| 9165 | } | ||
| 9166 | } | ||
| 9167 | 69376 | } | |
| 9168 | //Port quest rules to items | ||
| 9169 |
2/2✓ Branch 0 taken 108288 times.
✓ Branch 1 taken 69376 times.
|
177664 | if( s_version <= 31) |
| 9170 | { | ||
| 9171 |
2/2✓ Branch 0 taken 285 times.
✓ Branch 1 taken 69091 times.
|
69376 | if(tempitem.family == itype_bomb) |
| 9172 | { | ||
| 9173 |
2/2✓ Branch 0 taken 155 times.
✓ Branch 1 taken 130 times.
|
285 | if ( get_qr(qr_OUCHBOMBS) ) tempitem.flags |= ITEM_FLAG2; |
| 9174 | 130 | else tempitem.flags &= ~ ITEM_FLAG2; | |
| 9175 | 285 | } | |
| 9176 |
2/2✓ Branch 0 taken 271 times.
✓ Branch 1 taken 68820 times.
|
69091 | else if(tempitem.family == itype_sbomb) |
| 9177 | { | ||
| 9178 |
2/2✓ Branch 0 taken 157 times.
✓ Branch 1 taken 114 times.
|
271 | if ( get_qr(qr_OUCHBOMBS) ) tempitem.flags |= ITEM_FLAG2; |
| 9179 | 114 | else tempitem.flags &= ~ ITEM_FLAG2; | |
| 9180 | 271 | } | |
| 9181 | |||
| 9182 |
2/2✓ Branch 0 taken 813 times.
✓ Branch 1 taken 68007 times.
|
68820 | else if(tempitem.family == itype_brang) |
| 9183 | { | ||
| 9184 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 813 times.
|
813 | if ( get_qr(qr_BRANGPICKUP) ) tempitem.flags |= ITEM_FLAG4; |
| 9185 | 813 | else tempitem.flags &= ~ ITEM_FLAG4; | |
| 9186 | 813 | } | |
| 9187 |
2/2✓ Branch 0 taken 67720 times.
✓ Branch 1 taken 287 times.
|
68007 | else if(tempitem.family == itype_wand) |
| 9188 | { | ||
| 9189 |
2/2✓ Branch 0 taken 19 times.
✓ Branch 1 taken 268 times.
|
287 | if ( get_qr(qr_NOWANDMELEE) ) tempitem.flags |= ITEM_FLAG3; |
| 9190 | 268 | else tempitem.flags &= ~ ITEM_FLAG3; | |
| 9191 | 287 | } | |
| 9192 | 69376 | } | |
| 9193 | |||
| 9194 | //Port quest rules to items | ||
| 9195 |
2/2✓ Branch 0 taken 108288 times.
✓ Branch 1 taken 69376 times.
|
177664 | if( s_version <= 37) |
| 9196 | { | ||
| 9197 |
2/2✓ Branch 0 taken 271 times.
✓ Branch 1 taken 69105 times.
|
69376 | if(tempitem.family == itype_flippers) |
| 9198 | { | ||
| 9199 |
2/2✓ Branch 0 taken 78 times.
✓ Branch 1 taken 193 times.
|
271 | if ( (get_qr(qr_NODIVING)) ) tempitem.flags |= ITEM_FLAG1; |
| 9200 | 193 | else tempitem.flags &= ~ ITEM_FLAG1; | |
| 9201 | 271 | } | |
| 9202 |
2/2✓ Branch 0 taken 51590 times.
✓ Branch 1 taken 17515 times.
|
69105 | else if(tempitem.family == itype_sword) |
| 9203 | { | ||
| 9204 |
2/2✓ Branch 0 taken 462 times.
✓ Branch 1 taken 17053 times.
|
17515 | if ( (get_qr(qr_QUICKSWORD)) ) tempitem.flags |= ITEM_FLAG5; |
| 9205 | 17053 | else tempitem.flags &= ~ ITEM_FLAG5; | |
| 9206 | 17515 | } | |
| 9207 |
2/2✓ Branch 0 taken 287 times.
✓ Branch 1 taken 51303 times.
|
51590 | else if(tempitem.family == itype_wand) |
| 9208 | { | ||
| 9209 |
2/2✓ Branch 0 taken 10 times.
✓ Branch 1 taken 277 times.
|
287 | if ( (get_qr(qr_QUICKSWORD)) ) tempitem.flags |= ITEM_FLAG5; |
| 9210 | 277 | else tempitem.flags &= ~ ITEM_FLAG5; | |
| 9211 | 287 | } | |
| 9212 |
4/4✓ Branch 0 taken 51018 times.
✓ Branch 1 taken 285 times.
✓ Branch 2 taken 580 times.
✓ Branch 3 taken 50438 times.
|
51303 | else if(tempitem.family == itype_book || tempitem.family == itype_candle) |
| 9213 | { | ||
| 9214 | //@Emily: What was qrFIREPROOFHERO2 again, and does that also need to enable this? | ||
| 9215 |
2/2✓ Branch 0 taken 375 times.
✓ Branch 1 taken 490 times.
|
865 | if ( (get_qr(qr_FIREPROOFHERO)) ) tempitem.flags |= ITEM_FLAG3; |
| 9216 | 490 | else tempitem.flags &= ~ ITEM_FLAG3; | |
| 9217 | 865 | } | |
| 9218 | 69376 | } | |
| 9219 | |||
| 9220 |
2/2✓ Branch 0 taken 108288 times.
✓ Branch 1 taken 69376 times.
|
177664 | if( s_version < 38) |
| 9221 | { | ||
| 9222 |
4/4✓ Branch 0 taken 68563 times.
✓ Branch 1 taken 813 times.
✓ Branch 2 taken 540 times.
✓ Branch 3 taken 68023 times.
|
69376 | if(tempitem.family == itype_brang || tempitem.family == itype_hookshot) |
| 9223 | { | ||
| 9224 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1353 times.
|
1353 | if(get_qr(qr_BRANGPICKUP)) tempitem.flags |= ITEM_FLAG4; |
| 9225 | 1353 | else tempitem.flags &= ~ITEM_FLAG4; | |
| 9226 | |||
| 9227 |
2/2✓ Branch 0 taken 672 times.
✓ Branch 1 taken 681 times.
|
1353 | if(get_qr(qr_Z3BRANG_HSHOT)) tempitem.flags |= ITEM_FLAG5 | ITEM_FLAG6; |
| 9228 | 681 | else tempitem.flags &= ~(ITEM_FLAG5|ITEM_FLAG6); | |
| 9229 | 1353 | } | |
| 9230 |
2/2✓ Branch 0 taken 67222 times.
✓ Branch 1 taken 801 times.
|
68023 | else if(tempitem.family == itype_arrow) |
| 9231 | { | ||
| 9232 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 801 times.
|
801 | if(get_qr(qr_BRANGPICKUP)) tempitem.flags |= ITEM_FLAG4; |
| 9233 | 801 | else tempitem.flags &= ~ITEM_FLAG4; | |
| 9234 | |||
| 9235 |
2/2✓ Branch 0 taken 396 times.
✓ Branch 1 taken 405 times.
|
801 | if(get_qr(qr_Z3BRANG_HSHOT)) tempitem.flags &= ~ITEM_FLAG2; |
| 9236 | 405 | else tempitem.flags |= ITEM_FLAG2; | |
| 9237 | 801 | } | |
| 9238 | 69376 | } | |
| 9239 | |||
| 9240 |
2/2✓ Branch 0 taken 108288 times.
✓ Branch 1 taken 69376 times.
|
177664 | if( s_version < 39) |
| 9241 | { | ||
| 9242 |
6/6✓ Branch 0 taken 69107 times.
✓ Branch 1 taken 269 times.
✓ Branch 2 taken 68822 times.
✓ Branch 3 taken 285 times.
✓ Branch 4 taken 580 times.
✓ Branch 5 taken 68242 times.
|
69376 | if(tempitem.family == itype_divinefire || tempitem.family == itype_book || tempitem.family == itype_candle) |
| 9243 | { | ||
| 9244 |
2/2✓ Branch 0 taken 16 times.
✓ Branch 1 taken 1118 times.
|
1134 | if(get_qr(qr_TEMPCANDLELIGHT)) tempitem.flags |= ITEM_FLAG5; |
| 9245 | 1118 | else tempitem.flags &= ~ITEM_FLAG5; | |
| 9246 | 1134 | } | |
| 9247 |
2/2✓ Branch 0 taken 593 times.
✓ Branch 1 taken 67649 times.
|
68242 | else if(tempitem.family == itype_potion) |
| 9248 | { | ||
| 9249 |
2/2✓ Branch 0 taken 162 times.
✓ Branch 1 taken 431 times.
|
593 | if(get_qr(qr_NONBUBBLEMEDICINE)) |
| 9250 | { | ||
| 9251 | 162 | tempitem.flags &= ~(ITEM_FLAG3|ITEM_FLAG4); | |
| 9252 | 162 | } | |
| 9253 | else | ||
| 9254 | { | ||
| 9255 | 431 | tempitem.flags |= ITEM_FLAG3; | |
| 9256 |
2/2✓ Branch 0 taken 121 times.
✓ Branch 1 taken 310 times.
|
431 | if(get_qr(qr_ITEMBUBBLE))tempitem.flags |= ITEM_FLAG4; |
| 9257 | 310 | else tempitem.flags &= ~ITEM_FLAG4; | |
| 9258 | } | ||
| 9259 | 593 | } | |
| 9260 |
2/2✓ Branch 0 taken 67111 times.
✓ Branch 1 taken 538 times.
|
67649 | else if(tempitem.family == itype_triforcepiece) |
| 9261 | { | ||
| 9262 |
2/2✓ Branch 0 taken 84 times.
✓ Branch 1 taken 454 times.
|
538 | if(get_qr(qr_NONBUBBLETRIFORCE)) |
| 9263 | { | ||
| 9264 | 84 | tempitem.flags |= ITEM_FLAG3; | |
| 9265 |
2/2✓ Branch 0 taken 56 times.
✓ Branch 1 taken 28 times.
|
84 | if(get_qr(qr_ITEMBUBBLE))tempitem.flags |= ITEM_FLAG4; |
| 9266 | 28 | else tempitem.flags &= ~ITEM_FLAG4; | |
| 9267 | 84 | } | |
| 9268 | else | ||
| 9269 | { | ||
| 9270 | 454 | tempitem.flags &= ~(ITEM_FLAG3|ITEM_FLAG4); | |
| 9271 | } | ||
| 9272 | 538 | } | |
| 9273 | 69376 | } | |
| 9274 | |||
| 9275 |
2/2✓ Branch 0 taken 108288 times.
✓ Branch 1 taken 69376 times.
|
177664 | if( s_version < 40) |
| 9276 | { | ||
| 9277 |
4/4✓ Branch 0 taken 68515 times.
✓ Branch 1 taken 861 times.
✓ Branch 2 taken 295 times.
✓ Branch 3 taken 68220 times.
|
69376 | if(tempitem.family == itype_ring || tempitem.family == itype_perilring) |
| 9278 | { | ||
| 9279 |
2/2✓ Branch 0 taken 266 times.
✓ Branch 1 taken 890 times.
|
1156 | if(get_qr(qr_RINGAFFECTDAMAGE))tempitem.flags |= ITEM_FLAG1; |
| 9280 | 890 | else tempitem.flags &= ~ITEM_FLAG1; | |
| 9281 | 1156 | } | |
| 9282 |
8/8✓ Branch 0 taken 67640 times.
✓ Branch 1 taken 580 times.
✓ Branch 2 taken 50125 times.
✓ Branch 3 taken 17515 times.
✓ Branch 4 taken 49838 times.
✓ Branch 5 taken 287 times.
✓ Branch 6 taken 269 times.
✓ Branch 7 taken 49569 times.
|
68220 | else if(tempitem.family == itype_candle || tempitem.family == itype_sword || tempitem.family == itype_wand || tempitem.family == itype_cbyrna) |
| 9283 | { | ||
| 9284 |
2/2✓ Branch 0 taken 108 times.
✓ Branch 1 taken 18543 times.
|
18651 | if(get_qr(qr_SLASHFLIPFIX))tempitem.flags |= ITEM_FLAG8; |
| 9285 | 18543 | else tempitem.flags &= ~ITEM_FLAG8; | |
| 9286 | 18651 | } | |
| 9287 |
6/6✓ Branch 0 taken 51861 times.
✓ Branch 1 taken 17515 times.
✓ Branch 2 taken 51574 times.
✓ Branch 3 taken 287 times.
✓ Branch 4 taken 271 times.
✓ Branch 5 taken 51303 times.
|
69376 | if(tempitem.family == itype_sword || tempitem.family == itype_wand || tempitem.family == itype_hammer) |
| 9288 | { | ||
| 9289 |
2/2✓ Branch 0 taken 104 times.
✓ Branch 1 taken 17969 times.
|
18073 | if(get_qr(qr_NOITEMMELEE))tempitem.flags |= ITEM_FLAG7; |
| 9290 | 17969 | else tempitem.flags &= ~ITEM_FLAG7; | |
| 9291 | 18073 | } | |
| 9292 |
2/2✓ Branch 0 taken 51034 times.
✓ Branch 1 taken 269 times.
|
51303 | else if(tempitem.family == itype_cbyrna) |
| 9293 | { | ||
| 9294 | 269 | tempitem.flags |= ITEM_FLAG7; | |
| 9295 | 269 | } | |
| 9296 | 69376 | } | |
| 9297 | |||
| 9298 |
2/2✓ Branch 0 taken 108288 times.
✓ Branch 1 taken 69376 times.
|
177664 | if( s_version < 41 ) |
| 9299 | { | ||
| 9300 |
2/2✓ Branch 0 taken 51861 times.
✓ Branch 1 taken 17515 times.
|
69376 | if(tempitem.family == itype_sword) |
| 9301 | { | ||
| 9302 |
2/2✓ Branch 0 taken 188 times.
✓ Branch 1 taken 17327 times.
|
17515 | if(get_qr(qr_SWORDMIRROR))tempitem.flags |= ITEM_FLAG9; |
| 9303 | 17327 | else tempitem.flags &= ~ITEM_FLAG9; | |
| 9304 | |||
| 9305 |
2/2✓ Branch 0 taken 428 times.
✓ Branch 1 taken 17087 times.
|
17515 | if(get_qr(qr_SLOWCHARGINGWALK))tempitem.flags |= ITEM_FLAG10; |
| 9306 | 17087 | else tempitem.flags &= ~ITEM_FLAG10; | |
| 9307 | 17515 | } | |
| 9308 | 69376 | } | |
| 9309 | |||
| 9310 |
2/2✓ Branch 0 taken 108288 times.
✓ Branch 1 taken 69376 times.
|
177664 | if( s_version < 42 ) |
| 9311 | { | ||
| 9312 |
2/2✓ Branch 0 taken 287 times.
✓ Branch 1 taken 69089 times.
|
69376 | if(tempitem.family == itype_wand) |
| 9313 | { | ||
| 9314 |
2/2✓ Branch 0 taken 19 times.
✓ Branch 1 taken 268 times.
|
287 | if(get_qr(qr_NOWANDMELEE))tempitem.flags |= ITEM_FLAG3; |
| 9315 | 268 | else tempitem.flags &= ~ITEM_FLAG3; | |
| 9316 | |||
| 9317 | 287 | tempitem.flags &= ~ITEM_FLAG6; | |
| 9318 | 287 | } | |
| 9319 |
2/2✓ Branch 0 taken 271 times.
✓ Branch 1 taken 68818 times.
|
69089 | else if(tempitem.family == itype_hammer) |
| 9320 | { | ||
| 9321 | 271 | tempitem.flags &= ~ITEM_FLAG3; | |
| 9322 | 271 | } | |
| 9323 |
2/2✓ Branch 0 taken 269 times.
✓ Branch 1 taken 68549 times.
|
68818 | else if(tempitem.family == itype_cbyrna) |
| 9324 | { | ||
| 9325 | 269 | tempitem.flags |= ITEM_FLAG3; | |
| 9326 | |||
| 9327 | 269 | tempitem.flags &= ~ITEM_FLAG6; | |
| 9328 | 269 | } | |
| 9329 |
2/2✓ Branch 0 taken 51034 times.
✓ Branch 1 taken 17515 times.
|
68549 | else if(tempitem.family == itype_sword) |
| 9330 | { | ||
| 9331 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 17515 times.
|
17515 | if(get_qr(qr_MELEEMAGICCOST))tempitem.flags |= ITEM_FLAG6; |
| 9332 | 17515 | else tempitem.flags &= ~ITEM_FLAG6; | |
| 9333 | 17515 | } | |
| 9334 | 69376 | } | |
| 9335 | |||
| 9336 |
2/2✓ Branch 0 taken 108288 times.
✓ Branch 1 taken 69376 times.
|
177664 | if( s_version < 43 ) |
| 9337 | { | ||
| 9338 |
2/2✓ Branch 0 taken 69059 times.
✓ Branch 1 taken 317 times.
|
69376 | if(tempitem.family == itype_whistle) |
| 9339 | { | ||
| 9340 |
2/2✓ Branch 0 taken 8 times.
✓ Branch 1 taken 309 times.
|
317 | if(get_qr(qr_WHIRLWINDMIRROR))tempitem.flags |= ITEM_FLAG3; |
| 9341 | 309 | else tempitem.flags &= ~ITEM_FLAG3; | |
| 9342 | 317 | } | |
| 9343 | 69376 | } | |
| 9344 | |||
| 9345 |
2/2✓ Branch 0 taken 108288 times.
✓ Branch 1 taken 69376 times.
|
177664 | if( s_version < 45 ) |
| 9346 | { | ||
| 9347 |
2/2✓ Branch 0 taken 69105 times.
✓ Branch 1 taken 271 times.
|
69376 | if(tempitem.family == itype_flippers) |
| 9348 | { | ||
| 9349 | 271 | tempitem.misc1 = 50; //Dive length, default 50 frames -V | |
| 9350 | 271 | tempitem.misc2 = 30; //Dive cooldown, default 30 frames -V | |
| 9351 | 271 | } | |
| 9352 | 69376 | } | |
| 9353 | |||
| 9354 |
2/2✓ Branch 0 taken 108288 times.
✓ Branch 1 taken 69376 times.
|
177664 | if( s_version < 46 ) |
| 9355 | { | ||
| 9356 |
2/2✓ Branch 0 taken 69107 times.
✓ Branch 1 taken 269 times.
|
69376 | if(tempitem.family == itype_raft) |
| 9357 | { | ||
| 9358 | 269 | tempitem.misc1 = 1; //Rafting speed modifier; default 1. Negative slows, positive speeds. | |
| 9359 | 269 | } | |
| 9360 | 69376 | } | |
| 9361 |
2/2✓ Branch 0 taken 108288 times.
✓ Branch 1 taken 69376 times.
|
177664 | if ( s_version < 34 ) //! set the default counter for older quests. |
| 9362 | { | ||
| 9363 |
2/2✓ Branch 0 taken 106 times.
✓ Branch 1 taken 69270 times.
|
69376 | if ( (tempitem.flags & ITEM_RUPEE_MAGIC) ) |
| 9364 | { | ||
| 9365 | 106 | tempitem.cost_counter[0] = 1; | |
| 9366 | 106 | } | |
| 9367 | else | ||
| 9368 | { | ||
| 9369 |
2/2✓ Branch 0 taken 42240 times.
✓ Branch 1 taken 27030 times.
|
69270 | if(get_qr(qr_ENABLEMAGIC)) |
| 9370 | 42240 | tempitem.cost_counter[0] = 4; | |
| 9371 | else | ||
| 9372 | { | ||
| 9373 | 27030 | tempitem.cost_amount[0] = 0; | |
| 9374 | 27030 | tempitem.cost_counter[0] = -1; | |
| 9375 | } | ||
| 9376 | } | ||
| 9377 | 69376 | } | |
| 9378 | |||
| 9379 |
2/2✓ Branch 0 taken 108288 times.
✓ Branch 1 taken 69376 times.
|
177664 | if ( s_version < 35 ) //new Lens of Truth flags |
| 9380 | { | ||
| 9381 |
2/2✓ Branch 0 taken 69131 times.
✓ Branch 1 taken 245 times.
|
69376 | if ( tempitem.family == itype_lens ) |
| 9382 | { | ||
| 9383 |
2/2✓ Branch 0 taken 237 times.
✓ Branch 1 taken 8 times.
|
245 | if ( get_qr(qr_RAFTLENS) ) |
| 9384 | { | ||
| 9385 | 8 | tempitem.flags |= ITEM_FLAG4; | |
| 9386 | 8 | } | |
| 9387 |
2/2✓ Branch 0 taken 79 times.
✓ Branch 1 taken 166 times.
|
245 | if ( get_qr(qr_LENSHINTS) ) |
| 9388 | { | ||
| 9389 | 166 | tempitem.flags |= ITEM_FLAG1; | |
| 9390 | 166 | } | |
| 9391 |
2/2✓ Branch 0 taken 234 times.
✓ Branch 1 taken 11 times.
|
245 | if ( get_qr(qr_LENSSEESENEMIES) ) |
| 9392 | { | ||
| 9393 | 11 | tempitem.flags |= ITEM_FLAG5; | |
| 9394 | 11 | } | |
| 9395 | 245 | } | |
| 9396 | 69376 | } | |
| 9397 |
2/2✓ Branch 0 taken 108288 times.
✓ Branch 1 taken 69376 times.
|
177664 | if ( s_version < 44 ) //InitD Labels and Sprite Script Data |
| 9398 | { | ||
| 9399 |
2/2✓ Branch 0 taken 555008 times.
✓ Branch 1 taken 69376 times.
|
624384 | for ( int32_t q = 0; q < 8; q++ ) |
| 9400 | { | ||
| 9401 | 555008 | sprintf(tempitem.initD_label[q],"InitD[%d]",q); | |
| 9402 | 555008 | sprintf(tempitem.weapon_initD_label[q],"InitD[%d]",q); | |
| 9403 | 555008 | sprintf(tempitem.sprite_initD_label[q],"InitD[%d]",q); | |
| 9404 | 555008 | tempitem.sprite_initiald[q] = 0; | |
| 9405 | 555008 | } | |
| 9406 |
2/2✓ Branch 0 taken 138752 times.
✓ Branch 1 taken 69376 times.
|
208128 | for ( int32_t q = 0; q < 2; q++ ) tempitem.sprite_initiala[q] = 0; |
| 9407 | 69376 | tempitem.sprite_script = 0; | |
| 9408 | 69376 | } | |
| 9409 |
2/2✓ Branch 0 taken 108288 times.
✓ Branch 1 taken 69376 times.
|
177664 | if ( s_version < 47 ) //InitD Labels and Sprite Script Data |
| 9410 | { | ||
| 9411 | 69376 | tempitem.pickupflag = 0; | |
| 9412 | 69376 | } | |
| 9413 | |||
| 9414 |
2/2✓ Branch 0 taken 108288 times.
✓ Branch 1 taken 69376 times.
|
177664 | if( s_version < 51 ) |
| 9415 | { | ||
| 9416 |
2/2✓ Branch 0 taken 68796 times.
✓ Branch 1 taken 580 times.
|
69376 | if( tempitem.family == itype_candle ) |
| 9417 | { | ||
| 9418 | 580 | tempitem.misc4 = 50; //Step speed | |
| 9419 | 580 | } | |
| 9420 | 69376 | } | |
| 9421 | |||
| 9422 |
2/2✓ Branch 0 taken 108288 times.
✓ Branch 1 taken 69376 times.
|
177664 | if( s_version < 52 ) |
| 9423 | { | ||
| 9424 |
2/2✓ Branch 0 taken 68555 times.
✓ Branch 1 taken 821 times.
|
69376 | if( tempitem.family == itype_shield ) |
| 9425 | 821 | tempitem.flags |= ITEM_FLAG1; //'Block Front' flag | |
| 9426 | 69376 | } | |
| 9427 |
2/2✓ Branch 0 taken 108288 times.
✓ Branch 1 taken 69376 times.
|
177664 | if(s_version < 53) |
| 9428 | { | ||
| 9429 |
4/4✓ Branch 0 taken 68019 times.
✓ Branch 1 taken 801 times.
✓ Branch 2 taken 285 times.
✓ Branch 3 taken 271 times.
|
69376 | switch(tempitem.family) |
| 9430 | { | ||
| 9431 | case itype_arrow: | ||
| 9432 | 801 | tempitem.cost_counter[1] = crARROWS; | |
| 9433 | 801 | tempitem.cost_amount[1] = 1; | |
| 9434 | 801 | break; | |
| 9435 | case itype_bomb: | ||
| 9436 | 285 | tempitem.cost_counter[1] = crBOMBS; | |
| 9437 | 285 | tempitem.cost_amount[1] = 1; | |
| 9438 | 285 | break; | |
| 9439 | case itype_sbomb: | ||
| 9440 | 271 | tempitem.cost_counter[1] = crSBOMBS; | |
| 9441 | 271 | tempitem.cost_amount[1] = 1; | |
| 9442 | 271 | break; | |
| 9443 | default: | ||
| 9444 | 68019 | tempitem.cost_counter[1] = crNONE; | |
| 9445 | 68019 | tempitem.cost_amount[1] = 0; | |
| 9446 | 68019 | } | |
| 9447 | 69376 | tempitem.magiccosttimer[1] = 0; | |
| 9448 | 69376 | } | |
| 9449 |
2/2✓ Branch 0 taken 105472 times.
✓ Branch 1 taken 72192 times.
|
177664 | if( s_version < 54 ) |
| 9450 | { | ||
| 9451 |
2/2✓ Branch 0 taken 71908 times.
✓ Branch 1 taken 284 times.
|
72192 | if( tempitem.family == itype_flippers ) |
| 9452 | 284 | tempitem.misc3 = INT_BTN_A; //'Block Front' flag | |
| 9453 | 72192 | } | |
| 9454 |
2/2✓ Branch 0 taken 105472 times.
✓ Branch 1 taken 72192 times.
|
177664 | if(s_version < 55) |
| 9455 | { | ||
| 9456 |
3/3✓ Branch 0 taken 560 times.
✓ Branch 1 taken 560 times.
✓ Branch 2 taken 71072 times.
|
72192 | switch(tempitem.family) |
| 9457 | { | ||
| 9458 | case itype_spinscroll: | ||
| 9459 | case itype_quakescroll: | ||
| 9460 | 560 | tempitem.usesound2 = WAV_ZN1CHARGE; | |
| 9461 | 560 | break; | |
| 9462 | case itype_spinscroll2: | ||
| 9463 | case itype_quakescroll2: | ||
| 9464 | 560 | tempitem.usesound2 = WAV_ZN1CHARGE2; | |
| 9465 | 560 | break; | |
| 9466 | } | ||
| 9467 | 72192 | } | |
| 9468 |
2/2✓ Branch 0 taken 105472 times.
✓ Branch 1 taken 72192 times.
|
177664 | if(s_version < 56) |
| 9469 | { | ||
| 9470 |
4/4✓ Branch 0 taken 71010 times.
✓ Branch 1 taken 280 times.
✓ Branch 2 taken 606 times.
✓ Branch 3 taken 296 times.
|
72192 | switch(tempitem.family) |
| 9471 | { | ||
| 9472 | case itype_divinefire: | ||
| 9473 |
2/2✓ Branch 0 taken 269 times.
✓ Branch 1 taken 11 times.
|
280 | SETFLAG(tempitem.flags, ITEM_FLAG9, version < 0x255); //Strong Fire |
| 9474 |
2/2✓ Branch 0 taken 82 times.
✓ Branch 1 taken 198 times.
|
280 | SETFLAG(tempitem.flags, ITEM_FLAG10, version < 0x250); //Magic Fire |
| 9475 | 280 | tempitem.flags |= ITEM_FLAG11; //Divine Fire | |
| 9476 | 280 | break; | |
| 9477 | case itype_candle: | ||
| 9478 |
2/2✓ Branch 0 taken 302 times.
✓ Branch 1 taken 304 times.
|
606 | SETFLAG(tempitem.flags, ITEM_FLAG9, tempitem.fam_type > 1); //Strong Fire |
| 9479 | 606 | tempitem.flags &= ~ITEM_FLAG10; //Magic Fire | |
| 9480 | 606 | tempitem.flags &= ~ITEM_FLAG11; //Divine Fire | |
| 9481 | 606 | break; | |
| 9482 | case itype_book: | ||
| 9483 | 296 | tempitem.flags |= ITEM_FLAG9; //Strong Fire | |
| 9484 | 296 | tempitem.flags |= ITEM_FLAG10; //Magic Fire | |
| 9485 | 296 | tempitem.flags &= ~ITEM_FLAG11; //Divine Fire | |
| 9486 | 296 | break; | |
| 9487 | } | ||
| 9488 | 72192 | } | |
| 9489 | |||
| 9490 |
2/2✓ Branch 0 taken 166676 times.
✓ Branch 1 taken 10988 times.
|
177664 | if(tempitem.fam_type==0) // Always do this |
| 9491 | 10988 | tempitem.fam_type=1; | |
| 9492 | |||
| 9493 | 177664 | memcpy(&itemsbuf[i], &tempitem, sizeof(itemdata)); | |
| 9494 | 177664 | } | |
| 9495 | |||
| 9496 | 694 | return 0; | |
| 9497 | 695 | } | |
| 9498 | |||
| 9499 | static bool did_init_def_items = false; | ||
| 9500 | 355194 | void init_def_items() | |
| 9501 | { | ||
| 9502 |
2/2✓ Branch 0 taken 354881 times.
✓ Branch 1 taken 313 times.
|
355194 | if(did_init_def_items) return; |
| 9503 | 313 | did_init_def_items = true; | |
| 9504 | 313 | default_items[3].cost_counter[1] = crBOMBS; | |
| 9505 | 313 | default_items[13].cost_counter[1] = crARROWS; | |
| 9506 | 313 | default_items[14].cost_counter[1] = crARROWS; | |
| 9507 | 313 | default_items[48].cost_counter[1] = crSBOMBS; | |
| 9508 | 313 | default_items[57].cost_counter[1] = crARROWS; | |
| 9509 | 355194 | } | |
| 9510 | 355194 | void reset_itembuf(itemdata *item, int32_t id) | |
| 9511 | { | ||
| 9512 | 355194 | init_def_items(); | |
| 9513 |
2/2✓ Branch 0 taken 151533 times.
✓ Branch 1 taken 203661 times.
|
355194 | if(id<iLast) |
| 9514 | { | ||
| 9515 | // Copy everything *EXCEPT* the tile, misc, cset, frames, speed, delay and ltm. | ||
| 9516 | 203661 | word tile = item->tile; | |
| 9517 | 203661 | byte miscs = item->misc_flags, cset = item->csets, frames = item->frames, speed = item->speed, delay = item->delay; | |
| 9518 | 203661 | int32_t ltm = item->ltm; | |
| 9519 | |||
| 9520 | 203661 | memcpy(item,&default_items[id],sizeof(itemdata)); | |
| 9521 | 203661 | item->tile = tile; | |
| 9522 | 203661 | item->misc_flags = miscs; | |
| 9523 | 203661 | item->csets = cset; | |
| 9524 | 203661 | item->frames = frames; | |
| 9525 | 203661 | item->speed = speed; | |
| 9526 | 203661 | item->delay = delay; | |
| 9527 | 203661 | item->ltm = ltm; | |
| 9528 | 203661 | } | |
| 9529 | 355194 | } | |
| 9530 | |||
| 9531 | 89088 | void reset_itemname(int32_t id) | |
| 9532 | { | ||
| 9533 | 89088 | sprintf(item_string[id],"zz%03d",id); | |
| 9534 | |||
| 9535 |
2/2✓ Branch 0 taken 39324 times.
✓ Branch 1 taken 49764 times.
|
89088 | if(id < iLast) |
| 9536 | 49764 | strcpy(item_string[id],old_item_string[id]); | |
| 9537 | 89088 | } | |
| 9538 | |||
| 9539 | 695 | int32_t readweapons(PACKFILE *f, zquestheader *Header) | |
| 9540 | { | ||
| 9541 |
2/2✓ Branch 0 taken 671 times.
✓ Branch 1 taken 24 times.
|
695 | bool should_skip = legacy_skip_flags && get_bit(legacy_skip_flags, skip_weapons); |
| 9542 | |||
| 9543 | 695 | word weapons_to_read=MAXWPNS; | |
| 9544 | int32_t dummy; | ||
| 9545 | byte padding; | ||
| 9546 | wpndata tempweapon; | ||
| 9547 | 695 | word s_version=0, s_cversion=0; | |
| 9548 | |||
| 9549 | |||
| 9550 |
2/2✓ Branch 0 taken 689 times.
✓ Branch 1 taken 6 times.
|
695 | if(Header->zelda_version < 0x186) |
| 9551 | { | ||
| 9552 | 6 | weapons_to_read=64; | |
| 9553 | 6 | } | |
| 9554 | |||
| 9555 |
2/2✓ Branch 0 taken 689 times.
✓ Branch 1 taken 6 times.
|
695 | if(Header->zelda_version < 0x185) |
| 9556 | { | ||
| 9557 | 6 | weapons_to_read=32; | |
| 9558 | 6 | } | |
| 9559 | |||
| 9560 |
2/2✓ Branch 0 taken 24 times.
✓ Branch 1 taken 671 times.
|
695 | if(Header->zelda_version > 0x192) |
| 9561 | { | ||
| 9562 | 671 | weapons_to_read=0; | |
| 9563 | |||
| 9564 | //section version info | ||
| 9565 |
1/2✓ Branch 0 taken 671 times.
✗ Branch 1 not taken.
|
671 | if(!p_igetw(&s_version,f)) |
| 9566 | { | ||
| 9567 | ✗ | return qe_invalid; | |
| 9568 | } | ||
| 9569 | |||
| 9570 | 671 | FFCore.quest_format[vWeaponSprites] = s_version; | |
| 9571 | |||
| 9572 | //al_trace("Weapons version %d\n", s_version); | ||
| 9573 |
1/2✓ Branch 0 taken 671 times.
✗ Branch 1 not taken.
|
671 | if(!p_igetw(&s_cversion,f)) |
| 9574 | { | ||
| 9575 | ✗ | return qe_invalid; | |
| 9576 | } | ||
| 9577 | |||
| 9578 | //section size | ||
| 9579 |
1/2✓ Branch 0 taken 671 times.
✗ Branch 1 not taken.
|
671 | if(!p_igetl(&dummy,f)) |
| 9580 | { | ||
| 9581 | ✗ | return qe_invalid; | |
| 9582 | } | ||
| 9583 | |||
| 9584 | //finally... section data | ||
| 9585 |
1/2✓ Branch 0 taken 671 times.
✗ Branch 1 not taken.
|
671 | if(!p_igetw(&weapons_to_read,f)) |
| 9586 | { | ||
| 9587 | ✗ | return qe_invalid; | |
| 9588 | } | ||
| 9589 | |||
| 9590 |
2/4✓ Branch 0 taken 671 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 671 times.
|
671 | if (!(weapons_to_read >= 0 && weapons_to_read <= MAXWPNS)) |
| 9591 | { | ||
| 9592 | ✗ | return qe_invalid; | |
| 9593 | } | ||
| 9594 | 671 | } | |
| 9595 | |||
| 9596 |
2/2✓ Branch 0 taken 612 times.
✓ Branch 1 taken 83 times.
|
695 | if(s_version>2) |
| 9597 | { | ||
| 9598 |
2/2✓ Branch 0 taken 156672 times.
✓ Branch 1 taken 612 times.
|
157284 | for(int32_t i=0; i<weapons_to_read; i++) |
| 9599 | { | ||
| 9600 | char tempname[64]; | ||
| 9601 | |||
| 9602 |
1/2✓ Branch 0 taken 156672 times.
✗ Branch 1 not taken.
|
156672 | if(!pfread(tempname, 64, f)) |
| 9603 | { | ||
| 9604 | ✗ | return qe_invalid; | |
| 9605 | } | ||
| 9606 | |||
| 9607 | 156672 | weapon_string[i][0] = '\0'; | |
| 9608 | 156672 | strncat(weapon_string[i], tempname, 64 - 1); | |
| 9609 | 156672 | } | |
| 9610 | |||
| 9611 |
1/2✓ Branch 0 taken 612 times.
✗ Branch 1 not taken.
|
612 | if(s_version<4) |
| 9612 | { | ||
| 9613 | ✗ | strcpy(weapon_string[iwHover],old_weapon_string[iwHover]); | |
| 9614 | ✗ | strcpy(weapon_string[wFIREMAGIC],old_weapon_string[wFIREMAGIC]); | |
| 9615 | ✗ | } | |
| 9616 | |||
| 9617 |
1/2✓ Branch 0 taken 612 times.
✗ Branch 1 not taken.
|
612 | if(s_version<5) |
| 9618 | { | ||
| 9619 | ✗ | strcpy(weapon_string[iwQuarterHearts],old_weapon_string[iwQuarterHearts]); | |
| 9620 | ✗ | } | |
| 9621 | |||
| 9622 | /* | ||
| 9623 | if (s_version<6) | ||
| 9624 | { | ||
| 9625 | strcpy(weapon_string[iwSideRaft],old_weapon_string[iwSideRaft]); | ||
| 9626 | strcpy(weapon_string[iwSideLadder],old_weapon_string[iwSideLadder]); | ||
| 9627 | } | ||
| 9628 | */ | ||
| 9629 | 612 | } | |
| 9630 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 82 times.
|
83 | else if (!should_skip) |
| 9631 | { | ||
| 9632 |
2/2✓ Branch 0 taken 20992 times.
✓ Branch 1 taken 82 times.
|
21074 | for(int32_t i=0; i<MAXWPNS; i++) |
| 9633 | 20992 | reset_weaponname(i); | |
| 9634 | 82 | } | |
| 9635 | |||
| 9636 |
2/2✓ Branch 0 taken 165484 times.
✓ Branch 1 taken 695 times.
|
166179 | for(int32_t i=0; i<weapons_to_read; i++) |
| 9637 | { | ||
| 9638 | 165484 | word oldtile = 0; | |
| 9639 |
2/2✓ Branch 0 taken 107008 times.
✓ Branch 1 taken 58476 times.
|
165484 | if (s_version < 8) |
| 9640 | { | ||
| 9641 |
1/2✓ Branch 0 taken 58476 times.
✗ Branch 1 not taken.
|
58476 | if (!p_igetw(&oldtile, f)) |
| 9642 | ✗ | return qe_invalid; | |
| 9643 | 58476 | } | |
| 9644 | |||
| 9645 |
1/2✓ Branch 0 taken 165484 times.
✗ Branch 1 not taken.
|
165484 | if(!p_getc(&tempweapon.misc,f)) |
| 9646 | { | ||
| 9647 | ✗ | return qe_invalid; | |
| 9648 | } | ||
| 9649 | |||
| 9650 |
1/2✓ Branch 0 taken 165484 times.
✗ Branch 1 not taken.
|
165484 | if(!p_getc(&tempweapon.csets,f)) |
| 9651 | { | ||
| 9652 | ✗ | return qe_invalid; | |
| 9653 | } | ||
| 9654 | |||
| 9655 |
1/2✓ Branch 0 taken 165484 times.
✗ Branch 1 not taken.
|
165484 | if(!p_getc(&tempweapon.frames,f)) |
| 9656 | { | ||
| 9657 | ✗ | return qe_invalid; | |
| 9658 | } | ||
| 9659 | |||
| 9660 |
1/2✓ Branch 0 taken 165484 times.
✗ Branch 1 not taken.
|
165484 | if(!p_getc(&tempweapon.speed,f)) |
| 9661 | { | ||
| 9662 | ✗ | return qe_invalid; | |
| 9663 | } | ||
| 9664 | |||
| 9665 |
1/2✓ Branch 0 taken 165484 times.
✗ Branch 1 not taken.
|
165484 | if(!p_getc(&tempweapon.type,f)) |
| 9666 | { | ||
| 9667 | ✗ | return qe_invalid; | |
| 9668 | } | ||
| 9669 | |||
| 9670 |
2/2✓ Branch 0 taken 57196 times.
✓ Branch 1 taken 108288 times.
|
165484 | if ( s_version >= 7 ) |
| 9671 | { | ||
| 9672 |
1/2✓ Branch 0 taken 108288 times.
✗ Branch 1 not taken.
|
108288 | if(!p_igetw(&tempweapon.script,f)) |
| 9673 | { | ||
| 9674 | ✗ | return qe_invalid; | |
| 9675 | } | ||
| 9676 |
1/2✓ Branch 0 taken 108288 times.
✗ Branch 1 not taken.
|
108288 | if(!p_igetl(&tempweapon.tile,f)) |
| 9677 | { | ||
| 9678 | ✗ | return qe_invalid; | |
| 9679 | } | ||
| 9680 | 108288 | } | |
| 9681 |
2/2✓ Branch 0 taken 108288 times.
✓ Branch 1 taken 57196 times.
|
165484 | if ( s_version < 7 ) |
| 9682 | { | ||
| 9683 | 57196 | tempweapon.tile = oldtile; | |
| 9684 | 57196 | } | |
| 9685 | |||
| 9686 |
2/2✓ Branch 0 taken 160684 times.
✓ Branch 1 taken 4800 times.
|
165484 | if(Header->zelda_version < 0x193) |
| 9687 | { | ||
| 9688 |
1/2✓ Branch 0 taken 4800 times.
✗ Branch 1 not taken.
|
4800 | if(!p_getc(&padding,f)) |
| 9689 | { | ||
| 9690 | ✗ | return qe_invalid; | |
| 9691 | } | ||
| 9692 | 4800 | } | |
| 9693 | |||
| 9694 |
2/2✓ Branch 0 taken 156672 times.
✓ Branch 1 taken 8812 times.
|
165484 | if(s_version < 6) |
| 9695 | { | ||
| 9696 |
2/2✓ Branch 0 taken 18 times.
✓ Branch 1 taken 8794 times.
|
8812 | if(i==ewFIRETRAIL) |
| 9697 | { | ||
| 9698 | 18 | tempweapon.misc |= WF_BEHIND; | |
| 9699 | 18 | } | |
| 9700 | else | ||
| 9701 | 8794 | tempweapon.misc &= ~WF_BEHIND; | |
| 9702 | 8812 | } | |
| 9703 | |||
| 9704 |
2/2✓ Branch 0 taken 256 times.
✓ Branch 1 taken 165228 times.
|
165484 | if (!should_skip) |
| 9705 | 165228 | memcpy(&wpnsbuf[i], &tempweapon, sizeof(tempweapon)); | |
| 9706 | 165484 | } | |
| 9707 | |||
| 9708 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 694 times.
|
695 | if (should_skip) |
| 9709 | 1 | return 0; | |
| 9710 | |||
| 9711 |
2/2✓ Branch 0 taken 612 times.
✓ Branch 1 taken 82 times.
|
694 | if(s_version<2) |
| 9712 | { | ||
| 9713 | 82 | wpnsbuf[wSBOOM]=wpnsbuf[wBOOM]; | |
| 9714 | 82 | } | |
| 9715 | |||
| 9716 |
2/2✓ Branch 0 taken 612 times.
✓ Branch 1 taken 82 times.
|
694 | if(s_version<5) |
| 9717 | { | ||
| 9718 | 82 | wpnsbuf[iwQuarterHearts].tile=1; | |
| 9719 | 82 | wpnsbuf[iwQuarterHearts].csets=1; | |
| 9720 | 82 | } | |
| 9721 | |||
| 9722 |
1/2✓ Branch 0 taken 694 times.
✗ Branch 1 not taken.
|
694 | if(Header->zelda_version < 0x176) |
| 9723 | { | ||
| 9724 | ✗ | wpnsbuf[iwSpawn] = *((wpndata*)(itemsbuf + iMisc1)); | |
| 9725 | ✗ | wpnsbuf[iwDeath] = *((wpndata*)(itemsbuf + iMisc2)); | |
| 9726 | ✗ | memset(&itemsbuf[iMisc1],0,sizeof(itemdata)); | |
| 9727 | ✗ | memset(&itemsbuf[iMisc2],0,sizeof(itemdata)); | |
| 9728 | ✗ | } | |
| 9729 | |||
| 9730 |
3/4✓ Branch 0 taken 676 times.
✓ Branch 1 taken 18 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 5 times.
|
699 | if((Header->zelda_version < 0x192)|| |
| 9731 |
2/2✓ Branch 0 taken 5 times.
✓ Branch 1 taken 671 times.
|
676 | ((Header->zelda_version == 0x192)&&(Header->build<129))) |
| 9732 | { | ||
| 9733 | 18 | wpnsbuf[wHSCHAIN_V] = wpnsbuf[wHSCHAIN_H]; | |
| 9734 | 18 | } | |
| 9735 | |||
| 9736 |
2/2✓ Branch 0 taken 671 times.
✓ Branch 1 taken 23 times.
|
694 | if((Header->zelda_version < 0x210)) |
| 9737 | { | ||
| 9738 | 23 | wpnsbuf[wLSHEAD] = wpnsbuf[wHSHEAD]; | |
| 9739 | 23 | wpnsbuf[wLSCHAIN_H] = wpnsbuf[wHSCHAIN_H]; | |
| 9740 | 23 | wpnsbuf[wLSHANDLE] = wpnsbuf[wHSHANDLE]; | |
| 9741 | 23 | wpnsbuf[wLSCHAIN_V] = wpnsbuf[wHSCHAIN_V]; | |
| 9742 | 23 | } | |
| 9743 | |||
| 9744 | 694 | return 0; | |
| 9745 | 695 | } | |
| 9746 | |||
| 9747 | 694 | void init_guys(int32_t guyversion) | |
| 9748 | { | ||
| 9749 |
2/2✓ Branch 0 taken 355328 times.
✓ Branch 1 taken 694 times.
|
356022 | for(int32_t i=0; i<MAXGUYS; i++) |
| 9750 | { | ||
| 9751 | 355328 | guysbuf[i] = default_guys[0]; | |
| 9752 | 355328 | } | |
| 9753 | |||
| 9754 |
2/2✓ Branch 0 taken 122838 times.
✓ Branch 1 taken 694 times.
|
123532 | for(int32_t i=0; i<OLDMAXGUYS; i++) |
| 9755 | { | ||
| 9756 | 122838 | guysbuf[i] = default_guys[i]; | |
| 9757 |
2/2✓ Branch 0 taken 121450 times.
✓ Branch 1 taken 1388 times.
|
122838 | guysbuf[i].spr_shadow = (guysbuf[i].family==eeROCK && guysbuf[i].misc10==1) ? iwLargeShadow : iwShadow; |
| 9758 | 122838 | guysbuf[i].spr_death = iwDeath; | |
| 9759 | 122838 | guysbuf[i].spr_spawn = iwSpawn; | |
| 9760 | // Patra fix: 2.10 BSPatras used spDIG. 2.50 Patras use CSet 7. | ||
| 9761 |
4/4✓ Branch 0 taken 14514 times.
✓ Branch 1 taken 108324 times.
✓ Branch 2 taken 14432 times.
✓ Branch 3 taken 82 times.
|
122838 | if(guyversion<=3 && i==ePATRABS) |
| 9762 | { | ||
| 9763 | 82 | guysbuf[i].bosspal=spDIG; | |
| 9764 | 82 | guysbuf[i].cset=14; | |
| 9765 | 82 | guysbuf[i].misc9=14; | |
| 9766 | 82 | } | |
| 9767 | |||
| 9768 |
2/2✓ Branch 0 taken 108324 times.
✓ Branch 1 taken 14514 times.
|
122838 | if(guyversion<=3) |
| 9769 | { | ||
| 9770 | // Rope/Ghini Flash rules | ||
| 9771 |
2/2✓ Branch 0 taken 4071 times.
✓ Branch 1 taken 10443 times.
|
14514 | if(get_bit(deprecated_rules, qr_NOROPE2FLASH_DEP)) |
| 9772 | { | ||
| 9773 |
2/2✓ Branch 0 taken 10384 times.
✓ Branch 1 taken 59 times.
|
10443 | if(i==eROPE2) |
| 9774 | { | ||
| 9775 | 59 | guysbuf[i].flags2 &= ~guy_flashing; | |
| 9776 | 59 | } | |
| 9777 | 10443 | } | |
| 9778 | |||
| 9779 |
2/2✓ Branch 0 taken 12390 times.
✓ Branch 1 taken 2124 times.
|
14514 | if(get_bit(deprecated_rules, qr_NOBUBBLEFLASH_DEP)) |
| 9780 | { | ||
| 9781 |
12/12✓ Branch 0 taken 2112 times.
✓ Branch 1 taken 12 times.
✓ Branch 2 taken 2100 times.
✓ Branch 3 taken 12 times.
✓ Branch 4 taken 2088 times.
✓ Branch 5 taken 12 times.
✓ Branch 6 taken 2076 times.
✓ Branch 7 taken 12 times.
✓ Branch 8 taken 2064 times.
✓ Branch 9 taken 12 times.
✓ Branch 10 taken 12 times.
✓ Branch 11 taken 2052 times.
|
2124 | if(i==eBUBBLEST || i==eBUBBLESP || i==eBUBBLESR || i==eBUBBLEIT || i==eBUBBLEIP || i==eBUBBLEIR) |
| 9782 | { | ||
| 9783 | 72 | guysbuf[i].flags2 &= ~guy_flashing; | |
| 9784 | 72 | } | |
| 9785 | 2124 | } | |
| 9786 | |||
| 9787 |
2/2✓ Branch 0 taken 14432 times.
✓ Branch 1 taken 82 times.
|
14514 | if(i==eGHINI2) |
| 9788 | { | ||
| 9789 |
2/2✓ Branch 0 taken 78 times.
✓ Branch 1 taken 4 times.
|
82 | if(get_bit(deprecated_rules, qr_GHINI2BLINK_DEP)) |
| 9790 | { | ||
| 9791 | 4 | guysbuf[i].flags2 |= guy_blinking; | |
| 9792 | 4 | } | |
| 9793 | |||
| 9794 |
2/2✓ Branch 0 taken 44 times.
✓ Branch 1 taken 38 times.
|
82 | if(get_bit(deprecated_rules, qr_PHANTOMGHINI2_DEP)) |
| 9795 | { | ||
| 9796 | 38 | guysbuf[i].flags2 |= guy_transparent; | |
| 9797 | 38 | } | |
| 9798 | 82 | } | |
| 9799 | 14514 | } | |
| 9800 | |||
| 9801 | // Darknut fix | ||
| 9802 |
10/10✓ Branch 0 taken 122144 times.
✓ Branch 1 taken 694 times.
✓ Branch 2 taken 121450 times.
✓ Branch 3 taken 694 times.
✓ Branch 4 taken 120756 times.
✓ Branch 5 taken 694 times.
✓ Branch 6 taken 120062 times.
✓ Branch 7 taken 694 times.
✓ Branch 8 taken 694 times.
✓ Branch 9 taken 119368 times.
|
122838 | if(i==eDKNUT1 || i==eDKNUT2 || i==eDKNUT3 || i==eDKNUT4 || i==eDKNUT5) |
| 9803 | { | ||
| 9804 |
2/2✓ Branch 0 taken 3110 times.
✓ Branch 1 taken 360 times.
|
3470 | if(get_qr(qr_NEWENEMYTILES)) |
| 9805 | { | ||
| 9806 | 3110 | guysbuf[i].s_tile=guysbuf[i].e_tile+120; | |
| 9807 | 3110 | guysbuf[i].s_width=guysbuf[i].e_width; | |
| 9808 | 3110 | guysbuf[i].s_height=guysbuf[i].e_height; | |
| 9809 | 3110 | } | |
| 9810 | 360 | else guysbuf[i].s_tile=860; | |
| 9811 | |||
| 9812 |
2/2✓ Branch 0 taken 3060 times.
✓ Branch 1 taken 410 times.
|
3470 | if(get_bit(deprecated_rules,qr_BRKBLSHLDS_DEP)) |
| 9813 | { | ||
| 9814 | 410 | guysbuf[i].flags |= guy_bkshield; | |
| 9815 | 410 | } | |
| 9816 | 3470 | } | |
| 9817 | |||
| 9818 |
4/4✓ Branch 0 taken 122144 times.
✓ Branch 1 taken 694 times.
✓ Branch 2 taken 122788 times.
✓ Branch 3 taken 50 times.
|
122838 | if((i==eGELTRIB || i==eFGELTRIB) && get_bit(deprecated_rules,qr_OLDTRIBBLES_DEP)) |
| 9819 | { | ||
| 9820 | 50 | guysbuf[i].misc3 = (i==eFGELTRIB ? eFZOL : eZOL); | |
| 9821 | 50 | } | |
| 9822 | 122838 | } | |
| 9823 | 694 | } | |
| 9824 | |||
| 9825 | 20992 | void reset_weaponname(int32_t i) | |
| 9826 | { | ||
| 9827 |
2/2✓ Branch 0 taken 7216 times.
✓ Branch 1 taken 13776 times.
|
20992 | if(i<wLast) |
| 9828 | { | ||
| 9829 | 7216 | strcpy(weapon_string[i],old_weapon_string[i]); | |
| 9830 | 7216 | } | |
| 9831 | else | ||
| 9832 | 13776 | sprintf(weapon_string[i],"zz%03d",i); | |
| 9833 | 20992 | } | |
| 9834 | |||
| 9835 | 694 | void init_item_drop_sets() | |
| 9836 | { | ||
| 9837 |
2/2✓ Branch 0 taken 177664 times.
✓ Branch 1 taken 694 times.
|
178358 | for(int32_t i=0; i<MAXITEMDROPSETS; i++) |
| 9838 | { | ||
| 9839 | // item_drop_sets[i] = default_item_drop_sets[0]; | ||
| 9840 | 177664 | memset(&item_drop_sets[i], 0, sizeof(item_drop_object)); | |
| 9841 | 177664 | } | |
| 9842 | |||
| 9843 |
2/2✓ Branch 0 taken 9022 times.
✓ Branch 1 taken 694 times.
|
9716 | for(int32_t i=0; i<isMAX; i++) |
| 9844 | { | ||
| 9845 | 9022 | item_drop_sets[i] = default_item_drop_sets[i]; | |
| 9846 | |||
| 9847 | // Deprecated: qr_NOCLOCKS and qr_ALLOW10RUPEEDROPS | ||
| 9848 |
2/2✓ Branch 0 taken 90220 times.
✓ Branch 1 taken 9022 times.
|
99242 | for(int32_t j=0; j<10; ++j) |
| 9849 | { | ||
| 9850 | 90220 | int32_t it = item_drop_sets[i].item[j]; | |
| 9851 | |||
| 9852 |
3/4✓ Branch 0 taken 63664 times.
✓ Branch 1 taken 26556 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 4122 times.
|
90220 | if((itemsbuf[it].family == itype_rupee && ((itemsbuf[it].amount)&0xFFF) == 10) |
| 9853 |
2/2✓ Branch 0 taken 4122 times.
✓ Branch 1 taken 59542 times.
|
63664 | && !get_bit(deprecated_rules, qr_ALLOW10RUPEEDROPS_DEP)) |
| 9854 | { | ||
| 9855 | 4122 | item_drop_sets[i].chance[j+1]=0; | |
| 9856 | 4122 | } | |
| 9857 |
4/4✓ Branch 0 taken 2776 times.
✓ Branch 1 taken 83322 times.
✓ Branch 2 taken 144 times.
✓ Branch 3 taken 2632 times.
|
86098 | else if(itemsbuf[it].family == itype_clock && get_bit(deprecated_rules, qr_NOCLOCKS_DEP)) |
| 9858 | { | ||
| 9859 | 144 | item_drop_sets[i].chance[j+1]=0; | |
| 9860 | 144 | } | |
| 9861 | |||
| 9862 | // From Sept 2007 to Dec 2008, non-gameplay items were prohibited. | ||
| 9863 |
2/2✓ Branch 0 taken 90196 times.
✓ Branch 1 taken 24 times.
|
90220 | if(itemsbuf[it].family == itype_misc) |
| 9864 | { | ||
| 9865 | // If a non-gameplay item was selected, then item drop was aborted. | ||
| 9866 | // Reflect this by increasing the 'Nothing' chance accordingly. | ||
| 9867 | 24 | item_drop_sets[i].chance[0]+=item_drop_sets[i].chance[j+1]; | |
| 9868 | 24 | item_drop_sets[i].chance[j+1]=0; | |
| 9869 | 24 | } | |
| 9870 | 90220 | } | |
| 9871 | 9022 | } | |
| 9872 | 694 | } | |
| 9873 | |||
| 9874 | 694 | void init_favorites() | |
| 9875 | { | ||
| 9876 |
2/2✓ Branch 0 taken 874440 times.
✓ Branch 1 taken 694 times.
|
875134 | for(int32_t i=0; i<MAXFAVORITECOMBOS; i++) |
| 9877 | { | ||
| 9878 | 874440 | favorite_combos[i]=-1; | |
| 9879 | 874440 | } | |
| 9880 | 694 | } | |
| 9881 | |||
| 9882 | const char *ctype_name[cMAX]= | ||
| 9883 | { | ||
| 9884 | "cNONE", "cSTAIR", "cCAVE", "cWATER", "cARMOS", "cGRAVE", "cDOCK", | ||
| 9885 | "cUNDEF", "cPUSH_WAIT", "cPUSH_HEAVY", "cPUSH_HW", "cL_STATUE", "cR_STATUE", | ||
| 9886 | "cWALKSLOW", "cCVUP", "cCVDOWN", "cCVLEFT", "cCVRIGHT", "cSWIMWARP", "cDIVEWARP", | ||
| 9887 | "cLADDERHOOKSHOT", "cTRIGNOFLAG", "cTRIGFLAG", "cZELDA", "cSLASH", "cSLASHITEM", | ||
| 9888 | "cPUSH_HEAVY2", "cPUSH_HW2", "cPOUND", "cHSGRAB", "cHSBRIDGE", "cDAMAGE1", | ||
| 9889 | "cDAMAGE2", "cDAMAGE3", "cDAMAGE4", "cC_STATUE", "cTRAP_H", "cTRAP_V", "cTRAP_4", | ||
| 9890 | "cTRAP_LR", "cTRAP_UD", "cPIT", "cHOOKSHOTONLY", "cOVERHEAD", "cNOFLYZONE", "cMIRROR", | ||
| 9891 | "cMIRRORSLASH", "cMIRRORBACKSLASH", "cMAGICPRISM", "cMAGICPRISM4", | ||
| 9892 | "cMAGICSPONGE", "cCAVE2", "cEYEBALL_A", "cEYEBALL_B", "cNOJUMPZONE", "cBUSH", | ||
| 9893 | "cFLOWERS", "cTALLGRASS", "cSHALLOWWATER", "cLOCKBLOCK", "cLOCKBLOCK2", | ||
| 9894 | "cBOSSLOCKBLOCK", "cBOSSLOCKBLOCK2", "cLADDERONLY", "cBSGRAVE", | ||
| 9895 | "cCHEST", "cCHEST2", "cLOCKEDCHEST", "cLOCKEDCHEST2", "cBOSSCHEST", "cBOSSCHEST2", | ||
| 9896 | "cRESET", "cSAVE", "cSAVE2", "cCAVEB", "cCAVEC", "cCAVED", | ||
| 9897 | "cSTAIRB", "cSTAIRC", "cSTAIRD", "cPITB", "cPITC", "cPITD", | ||
| 9898 | "cCAVE2B", "cCAVE2C", "cCAVE2D", "cSWIMWARPB", "cSWIMWARPC", "cSWIMWARPD", | ||
| 9899 | "cDIVEWARPB", "cDIVEWARPC", "cDIVEWARPD", "cSTAIRR", "cPITR", | ||
| 9900 | "cAWARPA", "cAWARPB", "cAWARPC", "cAWARPD", "cAWARPR", | ||
| 9901 | "cSWARPA", "cSWARPB", "cSWARPC", "cSWARPD", "cSWARPR", "cSTRIGNOFLAG", "cSTRIGFLAG", | ||
| 9902 | "cSTEP", "cSTEPSAME", "cSTEPALL", "cSTEPCOPY", "cNOENEMY", "cBLOCKARROW1", "cBLOCKARROW2", | ||
| 9903 | "cBLOCKARROW3", "cBLOCKBRANG1", "cBLOCKBRANG2", "cBLOCKBRANG3", "cBLOCKSBEAM", "cBLOCKALL", | ||
| 9904 | "cBLOCKFIREBALL", "cDAMAGE5", "cDAMAGE6", "cDAMAGE7", "cCHANGE", "cSPINTILE1", "cSPINTILE2", | ||
| 9905 | "cSCREENFREEZE", "cSCREENFREEZEFF", "cNOGROUNDENEMY", "cSLASHNEXT", "cSLASHNEXTITEM", "cBUSHNEXT" | ||
| 9906 | "cSLASHTOUCHY", "cSLASHITEMTOUCHY", "cBUSHTOUCHY", "cFLOWERSTOUCHY", "cTALLGRASSTOUCHY", | ||
| 9907 | "cSLASHNEXTTOUCHY", "cSLASHNEXTITEMTOUCHY", "cBUSHNEXTTOUCHY", "cEYEBALL_4", "cTALLGRASSNEXT", | ||
| 9908 | "cSCRIPT1", "cSCRIPT2", "cSCRIPT3", "cSCRIPT4", "cSCRIPT5", | ||
| 9909 | "cSCRIPT6", "cSCRIPT7", "cSCRIPT8", "cSCRIPT9", "cSCRIPT10", | ||
| 9910 | "cSCRIPT11", "cSCRIPT12", "cSCRIPT13", "cSCRIPT14", "cSCRIPT15", | ||
| 9911 | "cSCRIPT16", "cSCRIPT17", "cSCRIPT18", "cSCRIPT19", "cSCRIPT20" | ||
| 9912 | |||
| 9913 | }; | ||
| 9914 | |||
| 9915 | 970 | int32_t init_combo_classes() | |
| 9916 | { | ||
| 9917 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 970 times.
|
970 | zinfo* zi = (load_tmp_zi ? load_tmp_zi : &ZI); |
| 9918 |
2/2✓ Branch 0 taken 177510 times.
✓ Branch 1 taken 970 times.
|
178480 | for(int32_t i=0; i<cMAX; i++) |
| 9919 | { | ||
| 9920 | 177510 | combo_class_buf[i] = default_combo_classes[i]; | |
| 9921 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 177510 times.
|
177510 | if ( char const* nm = zi->getComboTypeName(i) ) |
| 9922 | { | ||
| 9923 | 177510 | size_t len = strlen(nm); | |
| 9924 |
2/2✓ Branch 0 taken 11360640 times.
✓ Branch 1 taken 177510 times.
|
11538150 | for ( size_t q = 0; q < 64; q++ ) |
| 9925 | { | ||
| 9926 |
2/2✓ Branch 0 taken 2600570 times.
✓ Branch 1 taken 8760070 times.
|
11360640 | combo_class_buf[i].name[q] = (q<len ? nm[q] : 0); |
| 9927 | 11360640 | } | |
| 9928 | 177510 | } | |
| 9929 | 177510 | } | |
| 9930 | |||
| 9931 | 970 | return 0; | |
| 9932 | } | ||
| 9933 | |||
| 9934 | 294 | int32_t readherosprites2(PACKFILE *f, int32_t v_herosprites, int32_t cv_herosprites) | |
| 9935 | { | ||
| 9936 |
2/2✓ Branch 0 taken 46 times.
✓ Branch 1 taken 248 times.
|
294 | bool should_skip = legacy_skip_flags && get_bit(legacy_skip_flags, skip_herosprites); |
| 9937 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 294 times.
|
294 | if (should_skip) return 0; |
| 9938 | |||
| 9939 |
1/2✓ Branch 0 taken 294 times.
✗ Branch 1 not taken.
|
294 | assert(v_herosprites < 6); |
| 9940 | //these are here to bypass compiler warnings about unused arguments | ||
| 9941 | 294 | cv_herosprites=cv_herosprites; | |
| 9942 | |||
| 9943 | 294 | zinit.hero_swim_speed=67; //default | |
| 9944 | 294 | setupherotiles(zinit.heroAnimationStyle); | |
| 9945 | 294 | setupherodefenses(); | |
| 9946 | 294 | setupherooffsets(); | |
| 9947 | |||
| 9948 |
2/2✓ Branch 0 taken 105 times.
✓ Branch 1 taken 189 times.
|
294 | if(v_herosprites>=0) |
| 9949 | { | ||
| 9950 | word tile, tile2; | ||
| 9951 | byte flip, extend, dummy_byte; | ||
| 9952 | |||
| 9953 |
2/2✓ Branch 0 taken 756 times.
✓ Branch 1 taken 189 times.
|
945 | for(int32_t i=0; i<4; i++) |
| 9954 | { | ||
| 9955 |
1/2✓ Branch 0 taken 756 times.
✗ Branch 1 not taken.
|
756 | if(!p_igetw(&tile,f)) |
| 9956 | { | ||
| 9957 | ✗ | return qe_invalid; | |
| 9958 | } | ||
| 9959 | |||
| 9960 |
1/2✓ Branch 0 taken 756 times.
✗ Branch 1 not taken.
|
756 | if(!p_getc(&flip,f)) |
| 9961 | { | ||
| 9962 | ✗ | return qe_invalid; | |
| 9963 | } | ||
| 9964 | |||
| 9965 |
1/2✓ Branch 0 taken 756 times.
✗ Branch 1 not taken.
|
756 | if(!p_getc(&extend,f)) |
| 9966 | { | ||
| 9967 | ✗ | return qe_invalid; | |
| 9968 | } | ||
| 9969 | |||
| 9970 | 756 | walkspr[i][spr_tile]=(int32_t)tile; | |
| 9971 | 756 | walkspr[i][spr_flip]=(int32_t)flip; | |
| 9972 | 756 | walkspr[i][spr_extend]=(int32_t)extend; | |
| 9973 | 756 | } | |
| 9974 | |||
| 9975 |
2/2✓ Branch 0 taken 756 times.
✓ Branch 1 taken 189 times.
|
945 | for(int32_t i=0; i<4; i++) |
| 9976 | { | ||
| 9977 |
1/2✓ Branch 0 taken 756 times.
✗ Branch 1 not taken.
|
756 | if(!p_igetw(&tile,f)) |
| 9978 | { | ||
| 9979 | ✗ | return qe_invalid; | |
| 9980 | } | ||
| 9981 | |||
| 9982 |
1/2✓ Branch 0 taken 756 times.
✗ Branch 1 not taken.
|
756 | if(!p_getc(&flip,f)) |
| 9983 | { | ||
| 9984 | ✗ | return qe_invalid; | |
| 9985 | } | ||
| 9986 | |||
| 9987 |
1/2✓ Branch 0 taken 756 times.
✗ Branch 1 not taken.
|
756 | if(!p_getc(&extend,f)) |
| 9988 | { | ||
| 9989 | ✗ | return qe_invalid; | |
| 9990 | } | ||
| 9991 | |||
| 9992 | 756 | stabspr[i][spr_tile]=(int32_t)tile; | |
| 9993 | 756 | stabspr[i][spr_flip]=(int32_t)flip; | |
| 9994 | 756 | stabspr[i][spr_extend]=(int32_t)extend; | |
| 9995 | 756 | } | |
| 9996 | |||
| 9997 |
2/2✓ Branch 0 taken 756 times.
✓ Branch 1 taken 189 times.
|
945 | for(int32_t i=0; i<4; i++) |
| 9998 | { | ||
| 9999 |
1/2✓ Branch 0 taken 756 times.
✗ Branch 1 not taken.
|
756 | if(!p_igetw(&tile,f)) |
| 10000 | { | ||
| 10001 | ✗ | return qe_invalid; | |
| 10002 | } | ||
| 10003 | |||
| 10004 |
1/2✓ Branch 0 taken 756 times.
✗ Branch 1 not taken.
|
756 | if(!p_getc(&flip,f)) |
| 10005 | { | ||
| 10006 | ✗ | return qe_invalid; | |
| 10007 | } | ||
| 10008 | |||
| 10009 |
1/2✓ Branch 0 taken 756 times.
✗ Branch 1 not taken.
|
756 | if(!p_getc(&extend,f)) |
| 10010 | { | ||
| 10011 | ✗ | return qe_invalid; | |
| 10012 | } | ||
| 10013 | |||
| 10014 | 756 | slashspr[i][spr_tile]=(int32_t)tile; | |
| 10015 | 756 | slashspr[i][spr_flip]=(int32_t)flip; | |
| 10016 | 756 | slashspr[i][spr_extend]=(int32_t)extend; | |
| 10017 | 756 | } | |
| 10018 | |||
| 10019 |
2/2✓ Branch 0 taken 756 times.
✓ Branch 1 taken 189 times.
|
945 | for(int32_t i=0; i<4; i++) |
| 10020 | { | ||
| 10021 |
1/2✓ Branch 0 taken 756 times.
✗ Branch 1 not taken.
|
756 | if(!p_igetw(&tile,f)) |
| 10022 | { | ||
| 10023 | ✗ | return qe_invalid; | |
| 10024 | } | ||
| 10025 | |||
| 10026 |
1/2✓ Branch 0 taken 756 times.
✗ Branch 1 not taken.
|
756 | if(!p_getc(&flip,f)) |
| 10027 | { | ||
| 10028 | ✗ | return qe_invalid; | |
| 10029 | } | ||
| 10030 | |||
| 10031 |
1/2✓ Branch 0 taken 756 times.
✗ Branch 1 not taken.
|
756 | if(!p_getc(&extend,f)) |
| 10032 | { | ||
| 10033 | ✗ | return qe_invalid; | |
| 10034 | } | ||
| 10035 | |||
| 10036 | 756 | floatspr[i][spr_tile]=(int32_t)tile; | |
| 10037 | 756 | floatspr[i][spr_flip]=(int32_t)flip; | |
| 10038 | 756 | floatspr[i][spr_extend]=(int32_t)extend; | |
| 10039 | 756 | } | |
| 10040 | |||
| 10041 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 189 times.
|
189 | if(v_herosprites>1) |
| 10042 | { | ||
| 10043 |
2/2✓ Branch 0 taken 756 times.
✓ Branch 1 taken 189 times.
|
945 | for(int32_t i=0; i<4; i++) |
| 10044 | { | ||
| 10045 |
1/2✓ Branch 0 taken 756 times.
✗ Branch 1 not taken.
|
756 | if(!p_igetw(&tile,f)) |
| 10046 | { | ||
| 10047 | ✗ | return qe_invalid; | |
| 10048 | } | ||
| 10049 | |||
| 10050 |
1/2✓ Branch 0 taken 756 times.
✗ Branch 1 not taken.
|
756 | if(!p_getc(&flip,f)) |
| 10051 | { | ||
| 10052 | ✗ | return qe_invalid; | |
| 10053 | } | ||
| 10054 | |||
| 10055 |
1/2✓ Branch 0 taken 756 times.
✗ Branch 1 not taken.
|
756 | if(!p_getc(&extend,f)) |
| 10056 | { | ||
| 10057 | ✗ | return qe_invalid; | |
| 10058 | } | ||
| 10059 | |||
| 10060 | 756 | swimspr[i][spr_tile]=(int32_t)tile; | |
| 10061 | 756 | swimspr[i][spr_flip]=(int32_t)flip; | |
| 10062 | 756 | swimspr[i][spr_extend]=(int32_t)extend; | |
| 10063 | 756 | } | |
| 10064 | 189 | } | |
| 10065 | |||
| 10066 |
2/2✓ Branch 0 taken 756 times.
✓ Branch 1 taken 189 times.
|
945 | for(int32_t i=0; i<4; i++) |
| 10067 | { | ||
| 10068 |
1/2✓ Branch 0 taken 756 times.
✗ Branch 1 not taken.
|
756 | if(!p_igetw(&tile,f)) |
| 10069 | { | ||
| 10070 | ✗ | return qe_invalid; | |
| 10071 | } | ||
| 10072 | |||
| 10073 |
1/2✓ Branch 0 taken 756 times.
✗ Branch 1 not taken.
|
756 | if(!p_getc(&flip,f)) |
| 10074 | { | ||
| 10075 | ✗ | return qe_invalid; | |
| 10076 | } | ||
| 10077 | |||
| 10078 |
1/2✓ Branch 0 taken 756 times.
✗ Branch 1 not taken.
|
756 | if(!p_getc(&extend,f)) |
| 10079 | { | ||
| 10080 | ✗ | return qe_invalid; | |
| 10081 | } | ||
| 10082 | |||
| 10083 | 756 | divespr[i][spr_tile]=(int32_t)tile; | |
| 10084 | 756 | divespr[i][spr_flip]=(int32_t)flip; | |
| 10085 | 756 | divespr[i][spr_extend]=(int32_t)extend; | |
| 10086 | 756 | } | |
| 10087 | |||
| 10088 |
2/2✓ Branch 0 taken 756 times.
✓ Branch 1 taken 189 times.
|
945 | for(int32_t i=0; i<4; i++) |
| 10089 | { | ||
| 10090 |
1/2✓ Branch 0 taken 756 times.
✗ Branch 1 not taken.
|
756 | if(!p_igetw(&tile,f)) |
| 10091 | { | ||
| 10092 | ✗ | return qe_invalid; | |
| 10093 | } | ||
| 10094 | |||
| 10095 |
1/2✓ Branch 0 taken 756 times.
✗ Branch 1 not taken.
|
756 | if(!p_getc(&flip,f)) |
| 10096 | { | ||
| 10097 | ✗ | return qe_invalid; | |
| 10098 | } | ||
| 10099 | |||
| 10100 |
1/2✓ Branch 0 taken 756 times.
✗ Branch 1 not taken.
|
756 | if(!p_getc(&extend,f)) |
| 10101 | { | ||
| 10102 | ✗ | return qe_invalid; | |
| 10103 | } | ||
| 10104 | |||
| 10105 | 756 | poundspr[i][spr_tile]=(int32_t)tile; | |
| 10106 | 756 | poundspr[i][spr_flip]=(int32_t)flip; | |
| 10107 | 756 | poundspr[i][spr_extend]=(int32_t)extend; | |
| 10108 | 756 | } | |
| 10109 | |||
| 10110 |
1/2✓ Branch 0 taken 189 times.
✗ Branch 1 not taken.
|
189 | if(!p_igetw(&tile,f)) |
| 10111 | { | ||
| 10112 | ✗ | return qe_invalid; | |
| 10113 | } | ||
| 10114 | |||
| 10115 | 189 | flip=0; | |
| 10116 | |||
| 10117 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 189 times.
|
189 | if(v_herosprites>0) |
| 10118 | { | ||
| 10119 |
1/2✓ Branch 0 taken 189 times.
✗ Branch 1 not taken.
|
189 | if(!p_getc(&flip,f)) |
| 10120 | { | ||
| 10121 | ✗ | return qe_invalid; | |
| 10122 | } | ||
| 10123 | 189 | } | |
| 10124 | |||
| 10125 |
1/2✓ Branch 0 taken 189 times.
✗ Branch 1 not taken.
|
189 | if(!p_getc(&extend,f)) |
| 10126 | { | ||
| 10127 | ✗ | return qe_invalid; | |
| 10128 | } | ||
| 10129 | |||
| 10130 | 189 | castingspr[spr_tile]=(int32_t)tile; | |
| 10131 | 189 | castingspr[spr_flip]=(int32_t)flip; | |
| 10132 | 189 | castingspr[spr_extend]=(int32_t)extend; | |
| 10133 | |||
| 10134 |
1/2✓ Branch 0 taken 189 times.
✗ Branch 1 not taken.
|
189 | if(v_herosprites>0) |
| 10135 | { | ||
| 10136 | 189 | int32_t num_holdsprs = (v_herosprites > 6 ? 3 : 2); | |
| 10137 |
2/2✓ Branch 0 taken 378 times.
✓ Branch 1 taken 189 times.
|
567 | for(int32_t i=0; i<2; i++) |
| 10138 | { | ||
| 10139 |
2/2✓ Branch 0 taken 756 times.
✓ Branch 1 taken 378 times.
|
1134 | for(int32_t j=0; j<num_holdsprs; j++) |
| 10140 | { | ||
| 10141 |
1/2✓ Branch 0 taken 756 times.
✗ Branch 1 not taken.
|
756 | if(!p_igetw(&tile,f)) |
| 10142 | { | ||
| 10143 | ✗ | return qe_invalid; | |
| 10144 | } | ||
| 10145 | |||
| 10146 |
1/2✓ Branch 0 taken 756 times.
✗ Branch 1 not taken.
|
756 | if(!p_getc(&flip,f)) |
| 10147 | { | ||
| 10148 | ✗ | return qe_invalid; | |
| 10149 | } | ||
| 10150 | |||
| 10151 |
1/2✓ Branch 0 taken 756 times.
✗ Branch 1 not taken.
|
756 | if(!p_getc(&extend,f)) |
| 10152 | { | ||
| 10153 | ✗ | return qe_invalid; | |
| 10154 | } | ||
| 10155 | |||
| 10156 | 756 | holdspr[i][j][spr_tile]=(int32_t)tile; | |
| 10157 | 756 | holdspr[i][j][spr_flip]=(int32_t)flip; | |
| 10158 | 756 | holdspr[i][j][spr_extend]=(int32_t)extend; | |
| 10159 | 756 | } | |
| 10160 | 378 | } | |
| 10161 | 189 | } | |
| 10162 | else | ||
| 10163 | { | ||
| 10164 | ✗ | for(int32_t i=0; i<2; i++) | |
| 10165 | { | ||
| 10166 | ✗ | if(!p_igetw(&tile,f)) | |
| 10167 | { | ||
| 10168 | ✗ | return qe_invalid; | |
| 10169 | } | ||
| 10170 | |||
| 10171 | ✗ | if(!p_igetw(&tile2,f)) | |
| 10172 | { | ||
| 10173 | ✗ | return qe_invalid; | |
| 10174 | } | ||
| 10175 | |||
| 10176 | ✗ | if(!p_getc(&extend,f)) | |
| 10177 | { | ||
| 10178 | ✗ | return qe_invalid; | |
| 10179 | } | ||
| 10180 | |||
| 10181 | ✗ | holdspr[i][spr_hold1][spr_tile]=(int32_t)tile; | |
| 10182 | ✗ | holdspr[i][spr_hold1][spr_flip]=(int32_t)flip; | |
| 10183 | ✗ | holdspr[i][spr_hold1][spr_extend]=(int32_t)extend; | |
| 10184 | ✗ | holdspr[i][spr_hold2][spr_tile]=(int32_t)tile2; | |
| 10185 | ✗ | holdspr[i][spr_hold2][spr_flip]=(int32_t)flip; | |
| 10186 | ✗ | holdspr[i][spr_hold2][spr_extend]=(int32_t)extend; | |
| 10187 | ✗ | } | |
| 10188 | } | ||
| 10189 | |||
| 10190 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 189 times.
|
189 | if(v_herosprites>2) |
| 10191 | { | ||
| 10192 |
2/2✓ Branch 0 taken 756 times.
✓ Branch 1 taken 189 times.
|
945 | for(int32_t i=0; i<4; i++) |
| 10193 | { | ||
| 10194 |
1/2✓ Branch 0 taken 756 times.
✗ Branch 1 not taken.
|
756 | if(!p_igetw(&tile,f)) |
| 10195 | { | ||
| 10196 | ✗ | return qe_invalid; | |
| 10197 | } | ||
| 10198 | |||
| 10199 |
1/2✓ Branch 0 taken 756 times.
✗ Branch 1 not taken.
|
756 | if(!p_getc(&flip,f)) |
| 10200 | { | ||
| 10201 | ✗ | return qe_invalid; | |
| 10202 | } | ||
| 10203 | |||
| 10204 |
1/2✓ Branch 0 taken 756 times.
✗ Branch 1 not taken.
|
756 | if(!p_getc(&extend,f)) |
| 10205 | { | ||
| 10206 | ✗ | return qe_invalid; | |
| 10207 | } | ||
| 10208 | |||
| 10209 | 756 | jumpspr[i][spr_tile]=(int32_t)tile; | |
| 10210 | 756 | jumpspr[i][spr_flip]=(int32_t)flip; | |
| 10211 | 756 | jumpspr[i][spr_extend]=(int32_t)extend; | |
| 10212 | 756 | } | |
| 10213 | 189 | } | |
| 10214 | |||
| 10215 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 189 times.
|
189 | if(v_herosprites>3) |
| 10216 | { | ||
| 10217 |
2/2✓ Branch 0 taken 756 times.
✓ Branch 1 taken 189 times.
|
945 | for(int32_t i=0; i<4; i++) |
| 10218 | { | ||
| 10219 |
1/2✓ Branch 0 taken 756 times.
✗ Branch 1 not taken.
|
756 | if(!p_igetw(&tile,f)) |
| 10220 | { | ||
| 10221 | ✗ | return qe_invalid; | |
| 10222 | } | ||
| 10223 | |||
| 10224 |
1/2✓ Branch 0 taken 756 times.
✗ Branch 1 not taken.
|
756 | if(!p_getc(&flip,f)) |
| 10225 | { | ||
| 10226 | ✗ | return qe_invalid; | |
| 10227 | } | ||
| 10228 | |||
| 10229 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 756 times.
|
756 | if(!p_getc(&extend,f)) |
| 10230 | { | ||
| 10231 | ✗ | return qe_invalid; | |
| 10232 | } | ||
| 10233 | |||
| 10234 | 756 | chargespr[i][spr_tile]=(int32_t)tile; | |
| 10235 | 756 | chargespr[i][spr_flip]=(int32_t)flip; | |
| 10236 | 756 | chargespr[i][spr_extend]=(int32_t)extend; | |
| 10237 | 756 | } | |
| 10238 | 189 | } | |
| 10239 | |||
| 10240 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 189 times.
|
189 | if(v_herosprites>4) |
| 10241 | { | ||
| 10242 |
1/2✓ Branch 0 taken 189 times.
✗ Branch 1 not taken.
|
189 | if(!p_getc(&dummy_byte,f)) |
| 10243 | { | ||
| 10244 | ✗ | return qe_invalid; | |
| 10245 | } | ||
| 10246 | |||
| 10247 | 189 | zinit.hero_swim_speed=(byte)dummy_byte; | |
| 10248 | 189 | } | |
| 10249 | |||
| 10250 | 189 | memset(frozenspr, 0, sizeof(frozenspr)); | |
| 10251 | 189 | memset(frozen_waterspr, 0, sizeof(frozen_waterspr)); | |
| 10252 | 189 | memset(onfirespr, 0, sizeof(onfirespr)); | |
| 10253 | 189 | memset(onfire_waterspr, 0, sizeof(onfire_waterspr)); | |
| 10254 | 189 | memset(diggingspr, 0, sizeof(diggingspr)); | |
| 10255 | 189 | memset(usingrodspr, 0, sizeof(usingrodspr)); | |
| 10256 | 189 | memset(usingcanespr, 0, sizeof(usingcanespr)); | |
| 10257 | 189 | memset(pushingspr, 0, sizeof(pushingspr)); | |
| 10258 | 189 | memset(liftingspr, 0, sizeof(liftingspr)); | |
| 10259 | 189 | memset(liftingwalkspr, 0, sizeof(liftingwalkspr)); | |
| 10260 | 189 | memset(stunnedspr, 0, sizeof(stunnedspr)); | |
| 10261 | 189 | memset(stunned_waterspr, 0, sizeof(stunned_waterspr)); | |
| 10262 | 189 | memset(fallingspr, 0, sizeof(fallingspr)); | |
| 10263 | 189 | memset(shockedspr, 0, sizeof(shockedspr)); | |
| 10264 | 189 | memset(shocked_waterspr, 0, sizeof(shocked_waterspr)); | |
| 10265 | 189 | memset(pullswordspr, 0, sizeof(pullswordspr)); | |
| 10266 | 189 | memset(readingspr, 0, sizeof(readingspr)); | |
| 10267 | 189 | memset(slash180spr, 0, sizeof(slash180spr)); | |
| 10268 | 189 | memset(slashZ4spr, 0, sizeof(slashZ4spr)); | |
| 10269 | 189 | memset(dashspr, 0, sizeof(dashspr)); | |
| 10270 | 189 | memset(bonkspr, 0, sizeof(bonkspr)); | |
| 10271 | 189 | memset(medallionsprs, 0, sizeof(medallionsprs)); | |
| 10272 | 189 | memset(holdspr[0][2], 0, sizeof(holdspr[0][2])); //Sword hold (Land) | |
| 10273 | 189 | memset(holdspr[1][2], 0, sizeof(holdspr[1][2])); //Sword hold (Water) | |
| 10274 |
2/2✓ Branch 0 taken 756 times.
✓ Branch 1 taken 189 times.
|
945 | for(int32_t q = 0; q < 4; ++q) |
| 10275 | { | ||
| 10276 |
2/2✓ Branch 0 taken 2268 times.
✓ Branch 1 taken 756 times.
|
3024 | for(int32_t p = 0; p < 3; ++p) |
| 10277 | { | ||
| 10278 | 2268 | drowningspr[q][p] = divespr[q][p]; | |
| 10279 | 2268 | drowning_lavaspr[q][p] = divespr[q][p]; | |
| 10280 | 2268 | } | |
| 10281 | 756 | } | |
| 10282 | 189 | memset(sideswimspr, 0, sizeof(sideswimspr)); | |
| 10283 | 189 | memset(sideswimslashspr, 0, sizeof(sideswimslashspr)); | |
| 10284 | 189 | memset(sideswimstabspr, 0, sizeof(sideswimstabspr)); | |
| 10285 | 189 | memset(sideswimpoundspr, 0, sizeof(sideswimpoundspr)); | |
| 10286 | 189 | memset(sideswimchargespr, 0, sizeof(sideswimchargespr)); | |
| 10287 | 189 | memset(sideswimholdspr, 0, sizeof(sideswimholdspr)); | |
| 10288 | 189 | memset(sidedrowningspr, 0, sizeof(sidedrowningspr)); | |
| 10289 | 189 | } | |
| 10290 | |||
| 10291 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 294 times.
|
294 | if(FFCore.quest_format[vInitData] < 34) |
| 10292 | { | ||
| 10293 | 294 | bool fastswim = zinit.hero_swim_speed > 60; | |
| 10294 | // '2/3' or '1/2' | ||
| 10295 | 294 | zinit.hero_swim_mult = fastswim ? 2 : 1; | |
| 10296 | 294 | zinit.hero_swim_div = fastswim ? 3 : 2; | |
| 10297 | 294 | } | |
| 10298 | 294 | return 0; | |
| 10299 | 294 | } | |
| 10300 | |||
| 10301 | 71910 | void setSprite(int32_t* arr, int32_t tile, int32_t flip, int32_t ext) | |
| 10302 | { | ||
| 10303 | 71910 | arr[spr_tile] = tile; | |
| 10304 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 71910 times.
|
71910 | arr[spr_flip] = (flip > 3 ? 0 : flip); |
| 10305 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 71910 times.
|
71910 | arr[spr_extend] = (ext > 2 ? 0 : ext); |
| 10306 | 71910 | } | |
| 10307 | //Used to read the player sprites as int32_t, not word. | ||
| 10308 | 423 | int32_t readherosprites3(PACKFILE *f, int32_t v_herosprites, int32_t cv_herosprites) | |
| 10309 | { | ||
| 10310 | //these are here to bypass compiler warnings about unused arguments | ||
| 10311 | 423 | cv_herosprites=cv_herosprites; | |
| 10312 | |||
| 10313 | 423 | zinit.hero_swim_speed=67; //default | |
| 10314 | 423 | setupherotiles(zinit.heroAnimationStyle); | |
| 10315 | 423 | setupherodefenses(); | |
| 10316 | 423 | setupherooffsets(); | |
| 10317 | |||
| 10318 | int32_t tile, tile2; | ||
| 10319 | byte flip, extend, dummy_byte; | ||
| 10320 | |||
| 10321 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 423 times.
|
423 | if(v_herosprites>=0) |
| 10322 | { | ||
| 10323 | |||
| 10324 |
2/2✓ Branch 0 taken 1692 times.
✓ Branch 1 taken 423 times.
|
2115 | for(int32_t i=0; i<4; i++) |
| 10325 | { | ||
| 10326 |
1/2✓ Branch 0 taken 1692 times.
✗ Branch 1 not taken.
|
1692 | if(!p_igetl(&tile,f)) |
| 10327 | { | ||
| 10328 | ✗ | return qe_invalid; | |
| 10329 | } | ||
| 10330 | |||
| 10331 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1692 times.
|
1692 | if(!p_getc(&flip,f)) |
| 10332 | { | ||
| 10333 | ✗ | return qe_invalid; | |
| 10334 | } | ||
| 10335 | |||
| 10336 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1692 times.
|
1692 | if(!p_getc(&extend,f)) |
| 10337 | { | ||
| 10338 | ✗ | return qe_invalid; | |
| 10339 | } | ||
| 10340 | |||
| 10341 | 1692 | setSprite(walkspr[i], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 10342 | 1692 | } | |
| 10343 | |||
| 10344 |
2/2✓ Branch 0 taken 1692 times.
✓ Branch 1 taken 423 times.
|
2115 | for(int32_t i=0; i<4; i++) |
| 10345 | { | ||
| 10346 |
1/2✓ Branch 0 taken 1692 times.
✗ Branch 1 not taken.
|
1692 | if(!p_igetl(&tile,f)) |
| 10347 | { | ||
| 10348 | ✗ | return qe_invalid; | |
| 10349 | } | ||
| 10350 | |||
| 10351 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1692 times.
|
1692 | if(!p_getc(&flip,f)) |
| 10352 | { | ||
| 10353 | ✗ | return qe_invalid; | |
| 10354 | } | ||
| 10355 | |||
| 10356 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1692 times.
|
1692 | if(!p_getc(&extend,f)) |
| 10357 | { | ||
| 10358 | ✗ | return qe_invalid; | |
| 10359 | } | ||
| 10360 | |||
| 10361 | 1692 | setSprite(stabspr[i], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 10362 | 1692 | } | |
| 10363 | |||
| 10364 |
2/2✓ Branch 0 taken 1692 times.
✓ Branch 1 taken 423 times.
|
2115 | for(int32_t i=0; i<4; i++) |
| 10365 | { | ||
| 10366 |
1/2✓ Branch 0 taken 1692 times.
✗ Branch 1 not taken.
|
1692 | if(!p_igetl(&tile,f)) |
| 10367 | { | ||
| 10368 | ✗ | return qe_invalid; | |
| 10369 | } | ||
| 10370 | |||
| 10371 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1692 times.
|
1692 | if(!p_getc(&flip,f)) |
| 10372 | { | ||
| 10373 | ✗ | return qe_invalid; | |
| 10374 | } | ||
| 10375 | |||
| 10376 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1692 times.
|
1692 | if(!p_getc(&extend,f)) |
| 10377 | { | ||
| 10378 | ✗ | return qe_invalid; | |
| 10379 | } | ||
| 10380 | |||
| 10381 | 1692 | setSprite(slashspr[i], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 10382 | 1692 | } | |
| 10383 | |||
| 10384 |
2/2✓ Branch 0 taken 1692 times.
✓ Branch 1 taken 423 times.
|
2115 | for(int32_t i=0; i<4; i++) |
| 10385 | { | ||
| 10386 |
1/2✓ Branch 0 taken 1692 times.
✗ Branch 1 not taken.
|
1692 | if(!p_igetl(&tile,f)) |
| 10387 | { | ||
| 10388 | ✗ | return qe_invalid; | |
| 10389 | } | ||
| 10390 | |||
| 10391 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1692 times.
|
1692 | if(!p_getc(&flip,f)) |
| 10392 | { | ||
| 10393 | ✗ | return qe_invalid; | |
| 10394 | } | ||
| 10395 | |||
| 10396 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1692 times.
|
1692 | if(!p_getc(&extend,f)) |
| 10397 | { | ||
| 10398 | ✗ | return qe_invalid; | |
| 10399 | } | ||
| 10400 | |||
| 10401 | 1692 | setSprite(floatspr[i], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 10402 | 1692 | } | |
| 10403 | |||
| 10404 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 423 times.
|
423 | if(v_herosprites>1) |
| 10405 | { | ||
| 10406 |
2/2✓ Branch 0 taken 1692 times.
✓ Branch 1 taken 423 times.
|
2115 | for(int32_t i=0; i<4; i++) |
| 10407 | { | ||
| 10408 |
1/2✓ Branch 0 taken 1692 times.
✗ Branch 1 not taken.
|
1692 | if(!p_igetl(&tile,f)) |
| 10409 | { | ||
| 10410 | ✗ | return qe_invalid; | |
| 10411 | } | ||
| 10412 | |||
| 10413 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1692 times.
|
1692 | if(!p_getc(&flip,f)) |
| 10414 | { | ||
| 10415 | ✗ | return qe_invalid; | |
| 10416 | } | ||
| 10417 | |||
| 10418 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1692 times.
|
1692 | if(!p_getc(&extend,f)) |
| 10419 | { | ||
| 10420 | ✗ | return qe_invalid; | |
| 10421 | } | ||
| 10422 | |||
| 10423 | 1692 | setSprite(swimspr[i], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 10424 | 1692 | } | |
| 10425 | 423 | } | |
| 10426 | |||
| 10427 |
2/2✓ Branch 0 taken 1692 times.
✓ Branch 1 taken 423 times.
|
2115 | for(int32_t i=0; i<4; i++) |
| 10428 | { | ||
| 10429 |
1/2✓ Branch 0 taken 1692 times.
✗ Branch 1 not taken.
|
1692 | if(!p_igetl(&tile,f)) |
| 10430 | { | ||
| 10431 | ✗ | return qe_invalid; | |
| 10432 | } | ||
| 10433 | |||
| 10434 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1692 times.
|
1692 | if(!p_getc(&flip,f)) |
| 10435 | { | ||
| 10436 | ✗ | return qe_invalid; | |
| 10437 | } | ||
| 10438 | |||
| 10439 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1692 times.
|
1692 | if(!p_getc(&extend,f)) |
| 10440 | { | ||
| 10441 | ✗ | return qe_invalid; | |
| 10442 | } | ||
| 10443 | |||
| 10444 | 1692 | setSprite(divespr[i], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 10445 | 1692 | } | |
| 10446 | |||
| 10447 |
2/2✓ Branch 0 taken 1692 times.
✓ Branch 1 taken 423 times.
|
2115 | for(int32_t i=0; i<4; i++) |
| 10448 | { | ||
| 10449 |
1/2✓ Branch 0 taken 1692 times.
✗ Branch 1 not taken.
|
1692 | if(!p_igetl(&tile,f)) |
| 10450 | { | ||
| 10451 | ✗ | return qe_invalid; | |
| 10452 | } | ||
| 10453 | |||
| 10454 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1692 times.
|
1692 | if(!p_getc(&flip,f)) |
| 10455 | { | ||
| 10456 | ✗ | return qe_invalid; | |
| 10457 | } | ||
| 10458 | |||
| 10459 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1692 times.
|
1692 | if(!p_getc(&extend,f)) |
| 10460 | { | ||
| 10461 | ✗ | return qe_invalid; | |
| 10462 | } | ||
| 10463 | |||
| 10464 | 1692 | setSprite(poundspr[i], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 10465 | 1692 | } | |
| 10466 | |||
| 10467 |
1/2✓ Branch 0 taken 423 times.
✗ Branch 1 not taken.
|
423 | if(!p_igetl(&tile,f)) |
| 10468 | { | ||
| 10469 | ✗ | return qe_invalid; | |
| 10470 | } | ||
| 10471 | |||
| 10472 | 423 | flip=0; | |
| 10473 | |||
| 10474 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 423 times.
|
423 | if(v_herosprites>0) |
| 10475 | { | ||
| 10476 |
1/2✓ Branch 0 taken 423 times.
✗ Branch 1 not taken.
|
423 | if(!p_getc(&flip,f)) |
| 10477 | { | ||
| 10478 | ✗ | return qe_invalid; | |
| 10479 | } | ||
| 10480 | 423 | } | |
| 10481 | |||
| 10482 |
1/2✓ Branch 0 taken 423 times.
✗ Branch 1 not taken.
|
423 | if(!p_getc(&extend,f)) |
| 10483 | { | ||
| 10484 | ✗ | return qe_invalid; | |
| 10485 | } | ||
| 10486 | |||
| 10487 | 423 | setSprite(castingspr, int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 10488 | |||
| 10489 |
1/2✓ Branch 0 taken 423 times.
✗ Branch 1 not taken.
|
423 | if(v_herosprites>0) |
| 10490 | { | ||
| 10491 | 423 | int32_t num_holdsprs = (v_herosprites > 6 ? 3 : 2); | |
| 10492 |
2/2✓ Branch 0 taken 846 times.
✓ Branch 1 taken 423 times.
|
1269 | for(int32_t i=0; i<2; i++) |
| 10493 | { | ||
| 10494 |
2/2✓ Branch 0 taken 2538 times.
✓ Branch 1 taken 846 times.
|
3384 | for(int32_t j=0; j<num_holdsprs; j++) |
| 10495 | { | ||
| 10496 |
1/2✓ Branch 0 taken 2538 times.
✗ Branch 1 not taken.
|
2538 | if(!p_igetl(&tile,f)) |
| 10497 | { | ||
| 10498 | ✗ | return qe_invalid; | |
| 10499 | } | ||
| 10500 | |||
| 10501 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2538 times.
|
2538 | if(!p_getc(&flip,f)) |
| 10502 | { | ||
| 10503 | ✗ | return qe_invalid; | |
| 10504 | } | ||
| 10505 | |||
| 10506 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2538 times.
|
2538 | if(!p_getc(&extend,f)) |
| 10507 | { | ||
| 10508 | ✗ | return qe_invalid; | |
| 10509 | } | ||
| 10510 | |||
| 10511 | 2538 | setSprite(holdspr[i][j], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 10512 | 2538 | } | |
| 10513 | 846 | } | |
| 10514 | 423 | } | |
| 10515 | else | ||
| 10516 | { | ||
| 10517 | ✗ | for(int32_t i=0; i<2; i++) | |
| 10518 | { | ||
| 10519 | ✗ | if(!p_igetl(&tile,f)) | |
| 10520 | { | ||
| 10521 | ✗ | return qe_invalid; | |
| 10522 | } | ||
| 10523 | |||
| 10524 | ✗ | if(!p_igetl(&tile2,f)) | |
| 10525 | { | ||
| 10526 | ✗ | return qe_invalid; | |
| 10527 | } | ||
| 10528 | |||
| 10529 | ✗ | if(!p_getc(&extend,f)) | |
| 10530 | { | ||
| 10531 | ✗ | return qe_invalid; | |
| 10532 | } | ||
| 10533 | |||
| 10534 | ✗ | setSprite(holdspr[i][spr_hold1], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 10535 | ✗ | setSprite(holdspr[i][spr_hold2], int32_t(tile2), int32_t(flip), int32_t(extend)); | |
| 10536 | ✗ | } | |
| 10537 | } | ||
| 10538 | |||
| 10539 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 423 times.
|
423 | if(v_herosprites>2) |
| 10540 | { | ||
| 10541 |
2/2✓ Branch 0 taken 1692 times.
✓ Branch 1 taken 423 times.
|
2115 | for(int32_t i=0; i<4; i++) |
| 10542 | { | ||
| 10543 |
1/2✓ Branch 0 taken 1692 times.
✗ Branch 1 not taken.
|
1692 | if(!p_igetl(&tile,f)) |
| 10544 | { | ||
| 10545 | ✗ | return qe_invalid; | |
| 10546 | } | ||
| 10547 | |||
| 10548 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1692 times.
|
1692 | if(!p_getc(&flip,f)) |
| 10549 | { | ||
| 10550 | ✗ | return qe_invalid; | |
| 10551 | } | ||
| 10552 | |||
| 10553 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1692 times.
|
1692 | if(!p_getc(&extend,f)) |
| 10554 | { | ||
| 10555 | ✗ | return qe_invalid; | |
| 10556 | } | ||
| 10557 | |||
| 10558 | 1692 | setSprite(jumpspr[i], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 10559 | 1692 | } | |
| 10560 | 423 | } | |
| 10561 | |||
| 10562 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 423 times.
|
423 | if(v_herosprites>3) |
| 10563 | { | ||
| 10564 |
2/2✓ Branch 0 taken 1692 times.
✓ Branch 1 taken 423 times.
|
2115 | for(int32_t i=0; i<4; i++) |
| 10565 | { | ||
| 10566 |
1/2✓ Branch 0 taken 1692 times.
✗ Branch 1 not taken.
|
1692 | if(!p_igetl(&tile,f)) |
| 10567 | { | ||
| 10568 | ✗ | return qe_invalid; | |
| 10569 | } | ||
| 10570 | |||
| 10571 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1692 times.
|
1692 | if(!p_getc(&flip,f)) |
| 10572 | { | ||
| 10573 | ✗ | return qe_invalid; | |
| 10574 | } | ||
| 10575 | |||
| 10576 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1692 times.
|
1692 | if(!p_getc(&extend,f)) |
| 10577 | { | ||
| 10578 | ✗ | return qe_invalid; | |
| 10579 | } | ||
| 10580 | |||
| 10581 | 1692 | setSprite(chargespr[i], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 10582 | 1692 | } | |
| 10583 | 423 | } | |
| 10584 | |||
| 10585 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 423 times.
|
423 | if(v_herosprites>4) |
| 10586 | { | ||
| 10587 |
1/2✓ Branch 0 taken 423 times.
✗ Branch 1 not taken.
|
423 | if(!p_getc(&dummy_byte,f)) |
| 10588 | { | ||
| 10589 | ✗ | return qe_invalid; | |
| 10590 | } | ||
| 10591 | |||
| 10592 | 423 | zinit.hero_swim_speed=(byte)dummy_byte; | |
| 10593 | 423 | } | |
| 10594 | |||
| 10595 |
1/2✓ Branch 0 taken 423 times.
✗ Branch 1 not taken.
|
423 | if(v_herosprites>6) |
| 10596 | { | ||
| 10597 |
2/2✓ Branch 0 taken 1692 times.
✓ Branch 1 taken 423 times.
|
2115 | for(int32_t q = 0; q < 4; ++q) |
| 10598 | { | ||
| 10599 |
1/2✓ Branch 0 taken 1692 times.
✗ Branch 1 not taken.
|
1692 | if(!p_igetl(&tile,f)) |
| 10600 | ✗ | return qe_invalid; | |
| 10601 | |||
| 10602 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1692 times.
|
1692 | if(!p_getc(&flip,f)) |
| 10603 | ✗ | return qe_invalid; | |
| 10604 | |||
| 10605 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1692 times.
|
1692 | if(!p_getc(&extend,f)) |
| 10606 | ✗ | return qe_invalid; | |
| 10607 | |||
| 10608 | 1692 | setSprite(frozenspr[q], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 10609 | 1692 | } | |
| 10610 |
2/2✓ Branch 0 taken 1692 times.
✓ Branch 1 taken 423 times.
|
2115 | for(int32_t q = 0; q < 4; ++q) |
| 10611 | { | ||
| 10612 |
1/2✓ Branch 0 taken 1692 times.
✗ Branch 1 not taken.
|
1692 | if(!p_igetl(&tile,f)) |
| 10613 | ✗ | return qe_invalid; | |
| 10614 | |||
| 10615 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1692 times.
|
1692 | if(!p_getc(&flip,f)) |
| 10616 | ✗ | return qe_invalid; | |
| 10617 | |||
| 10618 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1692 times.
|
1692 | if(!p_getc(&extend,f)) |
| 10619 | ✗ | return qe_invalid; | |
| 10620 | |||
| 10621 | 1692 | setSprite(frozen_waterspr[q], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 10622 | 1692 | } | |
| 10623 | |||
| 10624 |
2/2✓ Branch 0 taken 1692 times.
✓ Branch 1 taken 423 times.
|
2115 | for(int32_t q = 0; q < 4; ++q) |
| 10625 | { | ||
| 10626 |
1/2✓ Branch 0 taken 1692 times.
✗ Branch 1 not taken.
|
1692 | if(!p_igetl(&tile,f)) |
| 10627 | ✗ | return qe_invalid; | |
| 10628 | |||
| 10629 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1692 times.
|
1692 | if(!p_getc(&flip,f)) |
| 10630 | ✗ | return qe_invalid; | |
| 10631 | |||
| 10632 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1692 times.
|
1692 | if(!p_getc(&extend,f)) |
| 10633 | ✗ | return qe_invalid; | |
| 10634 | |||
| 10635 | 1692 | setSprite(onfirespr[q], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 10636 | 1692 | } | |
| 10637 |
2/2✓ Branch 0 taken 1692 times.
✓ Branch 1 taken 423 times.
|
2115 | for(int32_t q = 0; q < 4; ++q) |
| 10638 | { | ||
| 10639 |
1/2✓ Branch 0 taken 1692 times.
✗ Branch 1 not taken.
|
1692 | if(!p_igetl(&tile,f)) |
| 10640 | ✗ | return qe_invalid; | |
| 10641 | |||
| 10642 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1692 times.
|
1692 | if(!p_getc(&flip,f)) |
| 10643 | ✗ | return qe_invalid; | |
| 10644 | |||
| 10645 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1692 times.
|
1692 | if(!p_getc(&extend,f)) |
| 10646 | ✗ | return qe_invalid; | |
| 10647 | |||
| 10648 | 1692 | setSprite(onfire_waterspr[q], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 10649 | 1692 | } | |
| 10650 | |||
| 10651 |
2/2✓ Branch 0 taken 1692 times.
✓ Branch 1 taken 423 times.
|
2115 | for(int32_t q = 0; q < 4; ++q) |
| 10652 | { | ||
| 10653 |
1/2✓ Branch 0 taken 1692 times.
✗ Branch 1 not taken.
|
1692 | if(!p_igetl(&tile,f)) |
| 10654 | ✗ | return qe_invalid; | |
| 10655 | |||
| 10656 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1692 times.
|
1692 | if(!p_getc(&flip,f)) |
| 10657 | ✗ | return qe_invalid; | |
| 10658 | |||
| 10659 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1692 times.
|
1692 | if(!p_getc(&extend,f)) |
| 10660 | ✗ | return qe_invalid; | |
| 10661 | |||
| 10662 | 1692 | setSprite(diggingspr[q], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 10663 | 1692 | } | |
| 10664 | |||
| 10665 |
2/2✓ Branch 0 taken 1692 times.
✓ Branch 1 taken 423 times.
|
2115 | for(int32_t q = 0; q < 4; ++q) |
| 10666 | { | ||
| 10667 |
1/2✓ Branch 0 taken 1692 times.
✗ Branch 1 not taken.
|
1692 | if(!p_igetl(&tile,f)) |
| 10668 | ✗ | return qe_invalid; | |
| 10669 | |||
| 10670 |
1/2✓ Branch 0 taken 1692 times.
✗ Branch 1 not taken.
|
1692 | if(!p_getc(&flip,f)) |
| 10671 | ✗ | return qe_invalid; | |
| 10672 | |||
| 10673 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1692 times.
|
1692 | if(!p_getc(&extend,f)) |
| 10674 | ✗ | return qe_invalid; | |
| 10675 | |||
| 10676 | 1692 | setSprite(usingrodspr[q], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 10677 | 1692 | } | |
| 10678 | |||
| 10679 |
2/2✓ Branch 0 taken 1692 times.
✓ Branch 1 taken 423 times.
|
2115 | for(int32_t q = 0; q < 4; ++q) |
| 10680 | { | ||
| 10681 |
1/2✓ Branch 0 taken 1692 times.
✗ Branch 1 not taken.
|
1692 | if(!p_igetl(&tile,f)) |
| 10682 | ✗ | return qe_invalid; | |
| 10683 | |||
| 10684 |
1/2✓ Branch 0 taken 1692 times.
✗ Branch 1 not taken.
|
1692 | if(!p_getc(&flip,f)) |
| 10685 | ✗ | return qe_invalid; | |
| 10686 | |||
| 10687 |
1/2✓ Branch 0 taken 1692 times.
✗ Branch 1 not taken.
|
1692 | if(!p_getc(&extend,f)) |
| 10688 | ✗ | return qe_invalid; | |
| 10689 | |||
| 10690 | 1692 | setSprite(usingcanespr[q], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 10691 | 1692 | } | |
| 10692 | |||
| 10693 |
2/2✓ Branch 0 taken 1692 times.
✓ Branch 1 taken 423 times.
|
2115 | for(int32_t q = 0; q < 4; ++q) |
| 10694 | { | ||
| 10695 |
1/2✓ Branch 0 taken 1692 times.
✗ Branch 1 not taken.
|
1692 | if(!p_igetl(&tile,f)) |
| 10696 | ✗ | return qe_invalid; | |
| 10697 | |||
| 10698 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1692 times.
|
1692 | if(!p_getc(&flip,f)) |
| 10699 | ✗ | return qe_invalid; | |
| 10700 | |||
| 10701 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1692 times.
|
1692 | if(!p_getc(&extend,f)) |
| 10702 | ✗ | return qe_invalid; | |
| 10703 | |||
| 10704 | 1692 | setSprite(pushingspr[q], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 10705 | 1692 | } | |
| 10706 | |||
| 10707 |
2/2✓ Branch 0 taken 1692 times.
✓ Branch 1 taken 423 times.
|
2115 | for(int32_t q = 0; q < 4; ++q) |
| 10708 | { | ||
| 10709 |
1/2✓ Branch 0 taken 1692 times.
✗ Branch 1 not taken.
|
1692 | if(!p_igetl(&tile,f)) |
| 10710 | ✗ | return qe_invalid; | |
| 10711 | |||
| 10712 |
1/2✓ Branch 0 taken 1692 times.
✗ Branch 1 not taken.
|
1692 | if(!p_getc(&flip,f)) |
| 10713 | ✗ | return qe_invalid; | |
| 10714 | |||
| 10715 |
1/2✓ Branch 0 taken 1692 times.
✗ Branch 1 not taken.
|
1692 | if(!p_getc(&extend,f)) |
| 10716 | ✗ | return qe_invalid; | |
| 10717 | |||
| 10718 | 1692 | byte frames = 0; | |
| 10719 |
2/2✓ Branch 0 taken 20 times.
✓ Branch 1 taken 1672 times.
|
1692 | if(v_herosprites > 15) |
| 10720 | { | ||
| 10721 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1672 times.
|
1672 | if(!p_getc(&frames,f)) |
| 10722 | ✗ | return qe_invalid; | |
| 10723 | 1672 | } | |
| 10724 | |||
| 10725 | 1692 | setSprite(liftingspr[q], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 10726 | 1692 | liftingspr[q][spr_frames] = frames; | |
| 10727 | 1692 | } | |
| 10728 | |||
| 10729 |
2/2✓ Branch 0 taken 1692 times.
✓ Branch 1 taken 423 times.
|
2115 | for(int32_t q = 0; q < 4; ++q) |
| 10730 | { | ||
| 10731 |
1/2✓ Branch 0 taken 1692 times.
✗ Branch 1 not taken.
|
1692 | if(!p_igetl(&tile,f)) |
| 10732 | ✗ | return qe_invalid; | |
| 10733 | |||
| 10734 |
1/2✓ Branch 0 taken 1692 times.
✗ Branch 1 not taken.
|
1692 | if(!p_getc(&flip,f)) |
| 10735 | ✗ | return qe_invalid; | |
| 10736 | |||
| 10737 |
1/2✓ Branch 0 taken 1692 times.
✗ Branch 1 not taken.
|
1692 | if(!p_getc(&extend,f)) |
| 10738 | ✗ | return qe_invalid; | |
| 10739 | |||
| 10740 | 1692 | setSprite(liftingwalkspr[q], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 10741 | 1692 | } | |
| 10742 | |||
| 10743 |
2/2✓ Branch 0 taken 1692 times.
✓ Branch 1 taken 423 times.
|
2115 | for(int32_t q = 0; q < 4; ++q) |
| 10744 | { | ||
| 10745 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1692 times.
|
1692 | if(!p_igetl(&tile,f)) |
| 10746 | ✗ | return qe_invalid; | |
| 10747 | |||
| 10748 |
1/2✓ Branch 0 taken 1692 times.
✗ Branch 1 not taken.
|
1692 | if(!p_getc(&flip,f)) |
| 10749 | ✗ | return qe_invalid; | |
| 10750 | |||
| 10751 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1692 times.
|
1692 | if(!p_getc(&extend,f)) |
| 10752 | ✗ | return qe_invalid; | |
| 10753 | |||
| 10754 | 1692 | setSprite(stunnedspr[q], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 10755 | 1692 | } | |
| 10756 |
2/2✓ Branch 0 taken 1692 times.
✓ Branch 1 taken 423 times.
|
2115 | for(int32_t q = 0; q < 4; ++q) |
| 10757 | { | ||
| 10758 |
1/2✓ Branch 0 taken 1692 times.
✗ Branch 1 not taken.
|
1692 | if(!p_igetl(&tile,f)) |
| 10759 | ✗ | return qe_invalid; | |
| 10760 | |||
| 10761 |
1/2✓ Branch 0 taken 1692 times.
✗ Branch 1 not taken.
|
1692 | if(!p_getc(&flip,f)) |
| 10762 | ✗ | return qe_invalid; | |
| 10763 | |||
| 10764 |
1/2✓ Branch 0 taken 1692 times.
✗ Branch 1 not taken.
|
1692 | if(!p_getc(&extend,f)) |
| 10765 | ✗ | return qe_invalid; | |
| 10766 | |||
| 10767 | 1692 | setSprite(stunned_waterspr[q], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 10768 | 1692 | } | |
| 10769 | |||
| 10770 |
2/2✓ Branch 0 taken 1692 times.
✓ Branch 1 taken 423 times.
|
2115 | for(int32_t q = 0; q < 4; ++q) |
| 10771 | { | ||
| 10772 |
1/2✓ Branch 0 taken 1692 times.
✗ Branch 1 not taken.
|
1692 | if(!p_igetl(&tile,f)) |
| 10773 | ✗ | return qe_invalid; | |
| 10774 | |||
| 10775 |
1/2✓ Branch 0 taken 1692 times.
✗ Branch 1 not taken.
|
1692 | if(!p_getc(&flip,f)) |
| 10776 | ✗ | return qe_invalid; | |
| 10777 | |||
| 10778 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1692 times.
|
1692 | if(!p_getc(&extend,f)) |
| 10779 | ✗ | return qe_invalid; | |
| 10780 | |||
| 10781 | 1692 | setSprite(drowningspr[q], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 10782 | 1692 | } | |
| 10783 | |||
| 10784 |
2/2✓ Branch 0 taken 1692 times.
✓ Branch 1 taken 423 times.
|
2115 | for(int32_t q = 0; q < 4; ++q) |
| 10785 | { | ||
| 10786 |
1/2✓ Branch 0 taken 1692 times.
✗ Branch 1 not taken.
|
1692 | if(!p_igetl(&tile,f)) |
| 10787 | ✗ | return qe_invalid; | |
| 10788 | |||
| 10789 |
1/2✓ Branch 0 taken 1692 times.
✗ Branch 1 not taken.
|
1692 | if(!p_getc(&flip,f)) |
| 10790 | ✗ | return qe_invalid; | |
| 10791 | |||
| 10792 |
1/2✓ Branch 0 taken 1692 times.
✗ Branch 1 not taken.
|
1692 | if(!p_getc(&extend,f)) |
| 10793 | ✗ | return qe_invalid; | |
| 10794 | |||
| 10795 | 1692 | setSprite(drowning_lavaspr[q], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 10796 | 1692 | } | |
| 10797 | |||
| 10798 |
2/2✓ Branch 0 taken 1692 times.
✓ Branch 1 taken 423 times.
|
2115 | for(int32_t q = 0; q < 4; ++q) |
| 10799 | { | ||
| 10800 |
1/2✓ Branch 0 taken 1692 times.
✗ Branch 1 not taken.
|
1692 | if(!p_igetl(&tile,f)) |
| 10801 | ✗ | return qe_invalid; | |
| 10802 | |||
| 10803 |
1/2✓ Branch 0 taken 1692 times.
✗ Branch 1 not taken.
|
1692 | if(!p_getc(&flip,f)) |
| 10804 | ✗ | return qe_invalid; | |
| 10805 | |||
| 10806 |
1/2✓ Branch 0 taken 1692 times.
✗ Branch 1 not taken.
|
1692 | if(!p_getc(&extend,f)) |
| 10807 | ✗ | return qe_invalid; | |
| 10808 | |||
| 10809 | 1692 | setSprite(fallingspr[q], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 10810 | 1692 | } | |
| 10811 | |||
| 10812 |
2/2✓ Branch 0 taken 1692 times.
✓ Branch 1 taken 423 times.
|
2115 | for(int32_t q = 0; q < 4; ++q) |
| 10813 | { | ||
| 10814 |
1/2✓ Branch 0 taken 1692 times.
✗ Branch 1 not taken.
|
1692 | if(!p_igetl(&tile,f)) |
| 10815 | ✗ | return qe_invalid; | |
| 10816 | |||
| 10817 |
1/2✓ Branch 0 taken 1692 times.
✗ Branch 1 not taken.
|
1692 | if(!p_getc(&flip,f)) |
| 10818 | ✗ | return qe_invalid; | |
| 10819 | |||
| 10820 |
1/2✓ Branch 0 taken 1692 times.
✗ Branch 1 not taken.
|
1692 | if(!p_getc(&extend,f)) |
| 10821 | ✗ | return qe_invalid; | |
| 10822 | |||
| 10823 | 1692 | setSprite(shockedspr[q], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 10824 | 1692 | } | |
| 10825 |
2/2✓ Branch 0 taken 1692 times.
✓ Branch 1 taken 423 times.
|
2115 | for(int32_t q = 0; q < 4; ++q) |
| 10826 | { | ||
| 10827 |
1/2✓ Branch 0 taken 1692 times.
✗ Branch 1 not taken.
|
1692 | if(!p_igetl(&tile,f)) |
| 10828 | ✗ | return qe_invalid; | |
| 10829 | |||
| 10830 |
1/2✓ Branch 0 taken 1692 times.
✗ Branch 1 not taken.
|
1692 | if(!p_getc(&flip,f)) |
| 10831 | ✗ | return qe_invalid; | |
| 10832 | |||
| 10833 |
1/2✓ Branch 0 taken 1692 times.
✗ Branch 1 not taken.
|
1692 | if(!p_getc(&extend,f)) |
| 10834 | ✗ | return qe_invalid; | |
| 10835 | |||
| 10836 | 1692 | setSprite(shocked_waterspr[q], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 10837 | 1692 | } | |
| 10838 | |||
| 10839 |
2/2✓ Branch 0 taken 1692 times.
✓ Branch 1 taken 423 times.
|
2115 | for(int32_t q = 0; q < 4; ++q) |
| 10840 | { | ||
| 10841 |
1/2✓ Branch 0 taken 1692 times.
✗ Branch 1 not taken.
|
1692 | if(!p_igetl(&tile,f)) |
| 10842 | ✗ | return qe_invalid; | |
| 10843 | |||
| 10844 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1692 times.
|
1692 | if(!p_getc(&flip,f)) |
| 10845 | ✗ | return qe_invalid; | |
| 10846 | |||
| 10847 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1692 times.
|
1692 | if(!p_getc(&extend,f)) |
| 10848 | ✗ | return qe_invalid; | |
| 10849 | |||
| 10850 | 1692 | setSprite(pullswordspr[q], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 10851 | 1692 | } | |
| 10852 | |||
| 10853 |
2/2✓ Branch 0 taken 1692 times.
✓ Branch 1 taken 423 times.
|
2115 | for(int32_t q = 0; q < 4; ++q) |
| 10854 | { | ||
| 10855 |
1/2✓ Branch 0 taken 1692 times.
✗ Branch 1 not taken.
|
1692 | if(!p_igetl(&tile,f)) |
| 10856 | ✗ | return qe_invalid; | |
| 10857 | |||
| 10858 |
1/2✓ Branch 0 taken 1692 times.
✗ Branch 1 not taken.
|
1692 | if(!p_getc(&flip,f)) |
| 10859 | ✗ | return qe_invalid; | |
| 10860 | |||
| 10861 |
1/2✓ Branch 0 taken 1692 times.
✗ Branch 1 not taken.
|
1692 | if(!p_getc(&extend,f)) |
| 10862 | ✗ | return qe_invalid; | |
| 10863 | |||
| 10864 | 1692 | setSprite(readingspr[q], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 10865 | 1692 | } | |
| 10866 | |||
| 10867 |
2/2✓ Branch 0 taken 1692 times.
✓ Branch 1 taken 423 times.
|
2115 | for(int32_t q = 0; q < 4; ++q) |
| 10868 | { | ||
| 10869 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1692 times.
|
1692 | if(!p_igetl(&tile,f)) |
| 10870 | ✗ | return qe_invalid; | |
| 10871 | |||
| 10872 |
1/2✓ Branch 0 taken 1692 times.
✗ Branch 1 not taken.
|
1692 | if(!p_getc(&flip,f)) |
| 10873 | ✗ | return qe_invalid; | |
| 10874 | |||
| 10875 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1692 times.
|
1692 | if(!p_getc(&extend,f)) |
| 10876 | ✗ | return qe_invalid; | |
| 10877 | |||
| 10878 | 1692 | setSprite(slash180spr[q], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 10879 | 1692 | } | |
| 10880 | |||
| 10881 |
2/2✓ Branch 0 taken 1692 times.
✓ Branch 1 taken 423 times.
|
2115 | for(int32_t q = 0; q < 4; ++q) |
| 10882 | { | ||
| 10883 |
1/2✓ Branch 0 taken 1692 times.
✗ Branch 1 not taken.
|
1692 | if(!p_igetl(&tile,f)) |
| 10884 | ✗ | return qe_invalid; | |
| 10885 | |||
| 10886 |
1/2✓ Branch 0 taken 1692 times.
✗ Branch 1 not taken.
|
1692 | if(!p_getc(&flip,f)) |
| 10887 | ✗ | return qe_invalid; | |
| 10888 | |||
| 10889 |
1/2✓ Branch 0 taken 1692 times.
✗ Branch 1 not taken.
|
1692 | if(!p_getc(&extend,f)) |
| 10890 | ✗ | return qe_invalid; | |
| 10891 | |||
| 10892 | 1692 | setSprite(slashZ4spr[q], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 10893 | 1692 | } | |
| 10894 | |||
| 10895 |
2/2✓ Branch 0 taken 1692 times.
✓ Branch 1 taken 423 times.
|
2115 | for(int32_t q = 0; q < 4; ++q) |
| 10896 | { | ||
| 10897 |
1/2✓ Branch 0 taken 1692 times.
✗ Branch 1 not taken.
|
1692 | if(!p_igetl(&tile,f)) |
| 10898 | ✗ | return qe_invalid; | |
| 10899 | |||
| 10900 |
1/2✓ Branch 0 taken 1692 times.
✗ Branch 1 not taken.
|
1692 | if(!p_getc(&flip,f)) |
| 10901 | ✗ | return qe_invalid; | |
| 10902 | |||
| 10903 |
1/2✓ Branch 0 taken 1692 times.
✗ Branch 1 not taken.
|
1692 | if(!p_getc(&extend,f)) |
| 10904 | ✗ | return qe_invalid; | |
| 10905 | |||
| 10906 | 1692 | setSprite(dashspr[q], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 10907 | 1692 | } | |
| 10908 | |||
| 10909 |
2/2✓ Branch 0 taken 1692 times.
✓ Branch 1 taken 423 times.
|
2115 | for(int32_t q = 0; q < 4; ++q) |
| 10910 | { | ||
| 10911 |
1/2✓ Branch 0 taken 1692 times.
✗ Branch 1 not taken.
|
1692 | if(!p_igetl(&tile,f)) |
| 10912 | ✗ | return qe_invalid; | |
| 10913 | |||
| 10914 |
1/2✓ Branch 0 taken 1692 times.
✗ Branch 1 not taken.
|
1692 | if(!p_getc(&flip,f)) |
| 10915 | ✗ | return qe_invalid; | |
| 10916 | |||
| 10917 |
1/2✓ Branch 0 taken 1692 times.
✗ Branch 1 not taken.
|
1692 | if(!p_getc(&extend,f)) |
| 10918 | ✗ | return qe_invalid; | |
| 10919 | |||
| 10920 | 1692 | setSprite(bonkspr[q], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 10921 | 1692 | } | |
| 10922 | |||
| 10923 |
2/2✓ Branch 0 taken 1269 times.
✓ Branch 1 taken 423 times.
|
1692 | for(int32_t q = 0; q < 3; ++q) //Not directions; number of medallion sprs |
| 10924 | { | ||
| 10925 |
1/2✓ Branch 0 taken 1269 times.
✗ Branch 1 not taken.
|
1269 | if(!p_igetl(&tile,f)) |
| 10926 | ✗ | return qe_invalid; | |
| 10927 | |||
| 10928 |
1/2✓ Branch 0 taken 1269 times.
✗ Branch 1 not taken.
|
1269 | if(!p_getc(&flip,f)) |
| 10929 | ✗ | return qe_invalid; | |
| 10930 | |||
| 10931 |
1/2✓ Branch 0 taken 1269 times.
✗ Branch 1 not taken.
|
1269 | if(!p_getc(&extend,f)) |
| 10932 | ✗ | return qe_invalid; | |
| 10933 | |||
| 10934 | 1269 | setSprite(medallionsprs[q], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 10935 | 1269 | } | |
| 10936 | 423 | } | |
| 10937 | else | ||
| 10938 | { | ||
| 10939 | ✗ | memset(frozenspr, 0, sizeof(frozenspr)); | |
| 10940 | ✗ | memset(frozen_waterspr, 0, sizeof(frozen_waterspr)); | |
| 10941 | ✗ | memset(onfirespr, 0, sizeof(onfirespr)); | |
| 10942 | ✗ | memset(onfire_waterspr, 0, sizeof(onfire_waterspr)); | |
| 10943 | ✗ | memset(diggingspr, 0, sizeof(diggingspr)); | |
| 10944 | ✗ | memset(usingrodspr, 0, sizeof(usingrodspr)); | |
| 10945 | ✗ | memset(usingcanespr, 0, sizeof(usingcanespr)); | |
| 10946 | ✗ | memset(pushingspr, 0, sizeof(pushingspr)); | |
| 10947 | ✗ | memset(liftingspr, 0, sizeof(liftingspr)); | |
| 10948 | ✗ | memset(liftingwalkspr, 0, sizeof(liftingwalkspr)); | |
| 10949 | ✗ | memset(stunnedspr, 0, sizeof(stunnedspr)); | |
| 10950 | ✗ | memset(stunned_waterspr, 0, sizeof(stunned_waterspr)); | |
| 10951 | ✗ | memset(fallingspr, 0, sizeof(fallingspr)); | |
| 10952 | ✗ | memset(shockedspr, 0, sizeof(shockedspr)); | |
| 10953 | ✗ | memset(shocked_waterspr, 0, sizeof(shocked_waterspr)); | |
| 10954 | ✗ | memset(pullswordspr, 0, sizeof(pullswordspr)); | |
| 10955 | ✗ | memset(readingspr, 0, sizeof(readingspr)); | |
| 10956 | ✗ | memset(slash180spr, 0, sizeof(slash180spr)); | |
| 10957 | ✗ | memset(slashZ4spr, 0, sizeof(slashZ4spr)); | |
| 10958 | ✗ | memset(dashspr, 0, sizeof(dashspr)); | |
| 10959 | ✗ | memset(bonkspr, 0, sizeof(bonkspr)); | |
| 10960 | ✗ | memset(medallionsprs, 0, sizeof(medallionsprs)); | |
| 10961 | ✗ | memset(holdspr[0][2], 0, sizeof(holdspr[0][2])); //Sword hold (Land) | |
| 10962 | ✗ | memset(holdspr[1][2], 0, sizeof(holdspr[1][2])); //Sword hold (Water) | |
| 10963 | ✗ | for(int32_t q = 0; q < 4; ++q) | |
| 10964 | { | ||
| 10965 | ✗ | for(int32_t p = 0; p < 3; ++p) | |
| 10966 | { | ||
| 10967 | ✗ | drowningspr[q][p] = divespr[q][p]; | |
| 10968 | ✗ | drowning_lavaspr[q][p] = divespr[q][p]; | |
| 10969 | ✗ | } | |
| 10970 | ✗ | } | |
| 10971 | } | ||
| 10972 |
1/2✓ Branch 0 taken 423 times.
✗ Branch 1 not taken.
|
423 | if (v_herosprites > 8) |
| 10973 | { | ||
| 10974 |
2/2✓ Branch 0 taken 1692 times.
✓ Branch 1 taken 423 times.
|
2115 | for(int32_t q = 0; q < 4; ++q) |
| 10975 | { | ||
| 10976 |
1/2✓ Branch 0 taken 1692 times.
✗ Branch 1 not taken.
|
1692 | if(!p_igetl(&tile,f)) |
| 10977 | ✗ | return qe_invalid; | |
| 10978 | |||
| 10979 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1692 times.
|
1692 | if(!p_getc(&flip,f)) |
| 10980 | ✗ | return qe_invalid; | |
| 10981 | |||
| 10982 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1692 times.
|
1692 | if(!p_getc(&extend,f)) |
| 10983 | ✗ | return qe_invalid; | |
| 10984 | |||
| 10985 | 1692 | setSprite(sideswimspr[q], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 10986 | 1692 | } | |
| 10987 | 423 | } | |
| 10988 | else | ||
| 10989 | { | ||
| 10990 | ✗ | memset(sideswimspr, 0, sizeof(sideswimspr)); | |
| 10991 | } | ||
| 10992 |
1/2✓ Branch 0 taken 423 times.
✗ Branch 1 not taken.
|
423 | if (v_herosprites > 9) |
| 10993 | { | ||
| 10994 |
2/2✓ Branch 0 taken 1692 times.
✓ Branch 1 taken 423 times.
|
2115 | for(int32_t q = 0; q < 4; ++q) |
| 10995 | { | ||
| 10996 |
1/2✓ Branch 0 taken 1692 times.
✗ Branch 1 not taken.
|
1692 | if(!p_igetl(&tile,f)) |
| 10997 | ✗ | return qe_invalid; | |
| 10998 | |||
| 10999 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1692 times.
|
1692 | if(!p_getc(&flip,f)) |
| 11000 | ✗ | return qe_invalid; | |
| 11001 | |||
| 11002 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1692 times.
|
1692 | if(!p_getc(&extend,f)) |
| 11003 | ✗ | return qe_invalid; | |
| 11004 | |||
| 11005 | 1692 | setSprite(sideswimslashspr[q], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 11006 | 1692 | } | |
| 11007 |
2/2✓ Branch 0 taken 1692 times.
✓ Branch 1 taken 423 times.
|
2115 | for(int32_t q = 0; q < 4; ++q) |
| 11008 | { | ||
| 11009 |
1/2✓ Branch 0 taken 1692 times.
✗ Branch 1 not taken.
|
1692 | if(!p_igetl(&tile,f)) |
| 11010 | ✗ | return qe_invalid; | |
| 11011 | |||
| 11012 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1692 times.
|
1692 | if(!p_getc(&flip,f)) |
| 11013 | ✗ | return qe_invalid; | |
| 11014 | |||
| 11015 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1692 times.
|
1692 | if(!p_getc(&extend,f)) |
| 11016 | ✗ | return qe_invalid; | |
| 11017 | |||
| 11018 | 1692 | setSprite(sideswimstabspr[q], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 11019 | 1692 | } | |
| 11020 |
2/2✓ Branch 0 taken 1692 times.
✓ Branch 1 taken 423 times.
|
2115 | for(int32_t q = 0; q < 4; ++q) |
| 11021 | { | ||
| 11022 |
1/2✓ Branch 0 taken 1692 times.
✗ Branch 1 not taken.
|
1692 | if(!p_igetl(&tile,f)) |
| 11023 | ✗ | return qe_invalid; | |
| 11024 | |||
| 11025 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1692 times.
|
1692 | if(!p_getc(&flip,f)) |
| 11026 | ✗ | return qe_invalid; | |
| 11027 | |||
| 11028 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1692 times.
|
1692 | if(!p_getc(&extend,f)) |
| 11029 | ✗ | return qe_invalid; | |
| 11030 | |||
| 11031 | 1692 | setSprite(sideswimpoundspr[q], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 11032 | 1692 | } | |
| 11033 |
2/2✓ Branch 0 taken 1692 times.
✓ Branch 1 taken 423 times.
|
2115 | for(int32_t q = 0; q < 4; ++q) |
| 11034 | { | ||
| 11035 |
1/2✓ Branch 0 taken 1692 times.
✗ Branch 1 not taken.
|
1692 | if(!p_igetl(&tile,f)) |
| 11036 | ✗ | return qe_invalid; | |
| 11037 | |||
| 11038 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1692 times.
|
1692 | if(!p_getc(&flip,f)) |
| 11039 | ✗ | return qe_invalid; | |
| 11040 | |||
| 11041 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1692 times.
|
1692 | if(!p_getc(&extend,f)) |
| 11042 | ✗ | return qe_invalid; | |
| 11043 | |||
| 11044 | 1692 | setSprite(sideswimchargespr[q], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 11045 | 1692 | } | |
| 11046 | 423 | } | |
| 11047 | else | ||
| 11048 | { | ||
| 11049 | ✗ | memset(sideswimslashspr, 0, sizeof(sideswimslashspr)); | |
| 11050 | ✗ | memset(sideswimstabspr, 0, sizeof(sideswimstabspr)); | |
| 11051 | ✗ | memset(sideswimpoundspr, 0, sizeof(sideswimpoundspr)); | |
| 11052 | ✗ | memset(sideswimchargespr, 0, sizeof(sideswimchargespr)); | |
| 11053 | } | ||
| 11054 |
1/2✓ Branch 0 taken 423 times.
✗ Branch 1 not taken.
|
423 | if (v_herosprites > 10) |
| 11055 | { | ||
| 11056 |
2/2✓ Branch 0 taken 1692 times.
✓ Branch 1 taken 423 times.
|
2115 | for(int32_t q = 0; q < 4; ++q) |
| 11057 | { | ||
| 11058 | int32_t hmr; | ||
| 11059 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1692 times.
|
1692 | if(!p_igetl(&hmr,f)) |
| 11060 | ✗ | return qe_invalid; | |
| 11061 | |||
| 11062 | 1692 | hammeroffsets[q] = hmr; | |
| 11063 | 1692 | } | |
| 11064 | 423 | } | |
| 11065 | else | ||
| 11066 | { | ||
| 11067 | ✗ | for(int32_t q = 0; q < 4; ++q) hammeroffsets[q] = 0; | |
| 11068 | } | ||
| 11069 |
1/2✓ Branch 0 taken 423 times.
✗ Branch 1 not taken.
|
423 | if (v_herosprites > 11) |
| 11070 | { | ||
| 11071 |
2/2✓ Branch 0 taken 1269 times.
✓ Branch 1 taken 423 times.
|
1692 | for(int32_t q = 0; q < 3; ++q) |
| 11072 | { | ||
| 11073 |
1/2✓ Branch 0 taken 1269 times.
✗ Branch 1 not taken.
|
1269 | if(!p_igetl(&tile,f)) |
| 11074 | ✗ | return qe_invalid; | |
| 11075 | |||
| 11076 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1269 times.
|
1269 | if(!p_getc(&flip,f)) |
| 11077 | ✗ | return qe_invalid; | |
| 11078 | |||
| 11079 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1269 times.
|
1269 | if(!p_getc(&extend,f)) |
| 11080 | ✗ | return qe_invalid; | |
| 11081 | |||
| 11082 | 1269 | setSprite(sideswimholdspr[q], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 11083 | 1269 | } | |
| 11084 | 423 | } | |
| 11085 | else | ||
| 11086 | { | ||
| 11087 | ✗ | memset(sideswimholdspr, 0, sizeof(sideswimholdspr)); | |
| 11088 | } | ||
| 11089 |
1/2✓ Branch 0 taken 423 times.
✗ Branch 1 not taken.
|
423 | if (v_herosprites > 12) |
| 11090 | { | ||
| 11091 |
1/2✓ Branch 0 taken 423 times.
✗ Branch 1 not taken.
|
423 | if(!p_igetl(&tile,f)) |
| 11092 | ✗ | return qe_invalid; | |
| 11093 | |||
| 11094 |
1/2✓ Branch 0 taken 423 times.
✗ Branch 1 not taken.
|
423 | if(!p_getc(&flip,f)) |
| 11095 | ✗ | return qe_invalid; | |
| 11096 | |||
| 11097 |
1/2✓ Branch 0 taken 423 times.
✗ Branch 1 not taken.
|
423 | if(!p_getc(&extend,f)) |
| 11098 | ✗ | return qe_invalid; | |
| 11099 | 423 | setSprite(sideswimcastingspr, int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 11100 | |||
| 11101 | 423 | } | |
| 11102 | else | ||
| 11103 | { | ||
| 11104 | ✗ | memset(sideswimcastingspr, 0, sizeof(sideswimcastingspr)); | |
| 11105 | } | ||
| 11106 |
1/2✓ Branch 0 taken 423 times.
✗ Branch 1 not taken.
|
423 | if (v_herosprites > 13) |
| 11107 | { | ||
| 11108 |
2/2✓ Branch 0 taken 1692 times.
✓ Branch 1 taken 423 times.
|
2115 | for(int32_t q = 0; q < 4; ++q) |
| 11109 | { | ||
| 11110 |
1/2✓ Branch 0 taken 1692 times.
✗ Branch 1 not taken.
|
1692 | if(!p_igetl(&tile,f)) |
| 11111 | ✗ | return qe_invalid; | |
| 11112 | |||
| 11113 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1692 times.
|
1692 | if(!p_getc(&flip,f)) |
| 11114 | ✗ | return qe_invalid; | |
| 11115 | |||
| 11116 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1692 times.
|
1692 | if(!p_getc(&extend,f)) |
| 11117 | ✗ | return qe_invalid; | |
| 11118 | |||
| 11119 | 1692 | setSprite(sidedrowningspr[q], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 11120 | 1692 | } | |
| 11121 | 423 | } | |
| 11122 | else | ||
| 11123 | { | ||
| 11124 | ✗ | memset(sidedrowningspr, 0, sizeof(sidedrowningspr)); | |
| 11125 | } | ||
| 11126 |
1/2✓ Branch 0 taken 423 times.
✗ Branch 1 not taken.
|
423 | if (v_herosprites > 14) |
| 11127 | { | ||
| 11128 |
2/2✓ Branch 0 taken 1692 times.
✓ Branch 1 taken 423 times.
|
2115 | for(int32_t q = 0; q < 4; ++q) |
| 11129 | { | ||
| 11130 |
1/2✓ Branch 0 taken 1692 times.
✗ Branch 1 not taken.
|
1692 | if(!p_igetl(&tile,f)) |
| 11131 | ✗ | return qe_invalid; | |
| 11132 | |||
| 11133 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1692 times.
|
1692 | if(!p_getc(&flip,f)) |
| 11134 | ✗ | return qe_invalid; | |
| 11135 | |||
| 11136 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1692 times.
|
1692 | if(!p_getc(&extend,f)) |
| 11137 | ✗ | return qe_invalid; | |
| 11138 | |||
| 11139 | 1692 | setSprite(revslashspr[q], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 11140 | 1692 | } | |
| 11141 | 423 | } | |
| 11142 | else | ||
| 11143 | { | ||
| 11144 | ✗ | memset(revslashspr, 0, sizeof(revslashspr)); | |
| 11145 | } | ||
| 11146 |
1/2✓ Branch 0 taken 423 times.
✗ Branch 1 not taken.
|
423 | if (v_herosprites > 7) |
| 11147 | { | ||
| 11148 | 423 | int32_t num_defense = wMax; | |
| 11149 | 423 | byte def = 0; | |
| 11150 | |||
| 11151 | //Set num_defense accordingly if changes to enum require version upgrade - Jman | ||
| 11152 | /*if(v_herosprites > [x]) | ||
| 11153 | * { | ||
| 11154 | * num_defense = 146 //value of wMax on version 8 | ||
| 11155 | * } | ||
| 11156 | */ | ||
| 11157 | |||
| 11158 |
2/2✓ Branch 0 taken 61758 times.
✓ Branch 1 taken 423 times.
|
62181 | for (int32_t q = 0; q < num_defense; q++) |
| 11159 | { | ||
| 11160 |
1/2✓ Branch 0 taken 61758 times.
✗ Branch 1 not taken.
|
61758 | if (!p_getc(&def, f)) |
| 11161 | ✗ | return qe_invalid; | |
| 11162 | |||
| 11163 | 61758 | hero_defence[q] = def; | |
| 11164 | 61758 | } | |
| 11165 | 423 | } | |
| 11166 | else | ||
| 11167 | { | ||
| 11168 | ✗ | int32_t num_defense = wMax; | |
| 11169 | ✗ | for (int32_t q = 0; q < num_defense; q++) | |
| 11170 | { | ||
| 11171 | ✗ | hero_defence[q] = 0; | |
| 11172 | ✗ | } | |
| 11173 | } | ||
| 11174 | 423 | } | |
| 11175 | |||
| 11176 |
2/2✓ Branch 0 taken 412 times.
✓ Branch 1 taken 11 times.
|
423 | if(FFCore.quest_format[vInitData] < 34) |
| 11177 | { | ||
| 11178 | 11 | bool fastswim = zinit.hero_swim_speed > 60; | |
| 11179 | // '2/3' or '1/2' | ||
| 11180 | 11 | zinit.hero_swim_mult = fastswim ? 2 : 1; | |
| 11181 | 11 | zinit.hero_swim_div = fastswim ? 3 : 2; | |
| 11182 | 11 | } | |
| 11183 | 423 | return 0; | |
| 11184 | 423 | } | |
| 11185 | |||
| 11186 | |||
| 11187 | 612 | int32_t readherosprites(PACKFILE *f, zquestheader *Header) | |
| 11188 | { | ||
| 11189 | //these are here to bypass compiler warnings about unused arguments | ||
| 11190 | 612 | Header=Header; | |
| 11191 | |||
| 11192 | dword dummy; | ||
| 11193 | 612 | word s_version=0, s_cversion=0; | |
| 11194 | |||
| 11195 | //section version info | ||
| 11196 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 612 times.
|
612 | if(!p_igetw(&s_version,f)) |
| 11197 | { | ||
| 11198 | ✗ | return qe_invalid; | |
| 11199 | } | ||
| 11200 | |||
| 11201 | 612 | FFCore.quest_format[vHeroSprites] = s_version; | |
| 11202 | |||
| 11203 | //al_trace("Player sprites version %d\n", s_version); | ||
| 11204 |
1/2✓ Branch 0 taken 612 times.
✗ Branch 1 not taken.
|
612 | if(!p_igetw(&s_cversion,f)) |
| 11205 | { | ||
| 11206 | ✗ | return qe_invalid; | |
| 11207 | } | ||
| 11208 | |||
| 11209 | //section size | ||
| 11210 |
1/2✓ Branch 0 taken 612 times.
✗ Branch 1 not taken.
|
612 | if(!p_igetl(&dummy,f)) |
| 11211 | { | ||
| 11212 | ✗ | return qe_invalid; | |
| 11213 | } | ||
| 11214 |
2/2✓ Branch 0 taken 423 times.
✓ Branch 1 taken 189 times.
|
612 | if ( s_version >= 6 ) |
| 11215 | { | ||
| 11216 | //al_trace("Reading Player Sprites v6\n"); | ||
| 11217 | 423 | return readherosprites3(f, s_version, dummy); | |
| 11218 | } | ||
| 11219 | 189 | else return readherosprites2(f, s_version, dummy); | |
| 11220 | 612 | } | |
| 11221 | |||
| 11222 | 207 | int32_t read_old_subscreens(PACKFILE *f, word s_version) | |
| 11223 | { | ||
| 11224 | 207 | subscreens_active.clear(); | |
| 11225 | 207 | subscreens_passive.clear(); | |
| 11226 | 207 | subscreens_overlay.clear(); | |
| 11227 |
2/2✓ Branch 0 taken 26496 times.
✓ Branch 1 taken 207 times.
|
26703 | for(int32_t i=0; i<MAXCUSTOMSUBSCREENS; i++) |
| 11228 | { | ||
| 11229 | subscreen_group g; | ||
| 11230 | 26496 | memset(&g,0,sizeof(subscreen_group)); | |
| 11231 | 26496 | int32_t ret = read_one_old_subscreen(f, &g, s_version); | |
| 11232 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 26496 times.
|
26496 | if(ret!=0) |
| 11233 | ✗ | return ret; | |
| 11234 |
2/2✓ Branch 0 taken 1074 times.
✓ Branch 1 taken 25422 times.
|
26496 | if(g.objects[0].type == ssoNULL) continue; |
| 11235 |
2/2✓ Branch 0 taken 450 times.
✓ Branch 1 taken 624 times.
|
1074 | auto& vec = g.ss_type == sstPASSIVE ? subscreens_passive : subscreens_active; |
| 11236 | 1074 | ZCSubscreen& sub = vec.emplace_back(); | |
| 11237 | 1074 | sub.load_old(g); | |
| 11238 | 1074 | } | |
| 11239 | |||
| 11240 | 207 | return 0; | |
| 11241 | 207 | } | |
| 11242 | |||
| 11243 | 26496 | int32_t read_one_old_subscreen(PACKFILE *f, subscreen_group* g, word s_version) | |
| 11244 | { | ||
| 11245 | 26496 | int32_t numsub=0; | |
| 11246 | 26496 | byte temp_ss=0; | |
| 11247 | subscreen_object temp_sub_stack; | ||
| 11248 | 26496 | subscreen_object *temp_sub = &temp_sub_stack; | |
| 11249 | |||
| 11250 | char tempname[64]; | ||
| 11251 | |||
| 11252 | // FWIW I never saw anything bigger than 20. | ||
| 11253 | #define MAX_DP1_LEN 1024 | ||
| 11254 | char tempdp1[MAX_DP1_LEN]; | ||
| 11255 | |||
| 11256 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 26496 times.
|
26496 | if(!pfread(tempname,64,f)) |
| 11257 | { | ||
| 11258 | ✗ | return qe_invalid; | |
| 11259 | } | ||
| 11260 | |||
| 11261 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 26496 times.
|
26496 | if(s_version > 1) |
| 11262 | { | ||
| 11263 |
1/2✓ Branch 0 taken 26496 times.
✗ Branch 1 not taken.
|
26496 | if(!p_getc(&temp_ss,f)) |
| 11264 | { | ||
| 11265 | ✗ | return qe_invalid; | |
| 11266 | } | ||
| 11267 | 26496 | } | |
| 11268 | |||
| 11269 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 26496 times.
|
26496 | if(s_version < 4) |
| 11270 | { | ||
| 11271 | ✗ | uint8_t tmp=0; | |
| 11272 | |||
| 11273 | ✗ | if(!p_getc(&tmp,f)) | |
| 11274 | { | ||
| 11275 | ✗ | return qe_invalid; | |
| 11276 | } | ||
| 11277 | |||
| 11278 | ✗ | numsub = (int32_t)tmp; | |
| 11279 | ✗ | } | |
| 11280 | else | ||
| 11281 | { | ||
| 11282 | word tmp; | ||
| 11283 | |||
| 11284 |
1/2✓ Branch 0 taken 26496 times.
✗ Branch 1 not taken.
|
26496 | if(!p_igetw(&tmp, f)) |
| 11285 | { | ||
| 11286 | ✗ | return qe_invalid; | |
| 11287 | } | ||
| 11288 | |||
| 11289 | 26496 | numsub = (int32_t)tmp; | |
| 11290 | } | ||
| 11291 | |||
| 11292 | int32_t j; | ||
| 11293 | |||
| 11294 |
3/4✗ Branch 0 not taken.
✓ Branch 1 taken 69602 times.
✓ Branch 2 taken 43106 times.
✓ Branch 3 taken 26496 times.
|
69602 | for(j=0; (j<MAXSUBSCREENITEMS&&j<numsub); j++) |
| 11295 | { | ||
| 11296 | 43106 | memset(temp_sub,0,sizeof(subscreen_object)); | |
| 11297 | |||
| 11298 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 43106 times.
|
43106 | switch(g->objects[j].type) |
| 11299 | { | ||
| 11300 | case ssoTEXT: | ||
| 11301 | case ssoTEXTBOX: | ||
| 11302 | case ssoCURRENTITEMTEXT: | ||
| 11303 | case ssoCURRENTITEMCLASSTEXT: | ||
| 11304 | ✗ | if(g->objects[j].dp1 != NULL) delete [](char *)g->objects[j].dp1; | |
| 11305 | |||
| 11306 | //fall through | ||
| 11307 | default: | ||
| 11308 | 43106 | memset(&g->objects[j],0,sizeof(subscreen_object)); | |
| 11309 | 43106 | break; | |
| 11310 | } | ||
| 11311 | |||
| 11312 |
1/2✓ Branch 0 taken 43106 times.
✗ Branch 1 not taken.
|
43106 | if(!p_getc(&(temp_sub->type),f)) |
| 11313 | ✗ | return qe_invalid; | |
| 11314 | |||
| 11315 |
1/2✓ Branch 0 taken 43106 times.
✗ Branch 1 not taken.
|
43106 | if(!p_getc(&(temp_sub->pos),f)) |
| 11316 | ✗ | return qe_invalid; | |
| 11317 | |||
| 11318 |
1/2✓ Branch 0 taken 43106 times.
✗ Branch 1 not taken.
|
43106 | if(s_version < 5) |
| 11319 | { | ||
| 11320 | ✗ | switch(temp_sub->pos) | |
| 11321 | { | ||
| 11322 | case 0: | ||
| 11323 | ✗ | temp_sub->pos = sspUP | sspDOWN | sspSCROLLING; | |
| 11324 | ✗ | break; | |
| 11325 | |||
| 11326 | case 1: | ||
| 11327 | ✗ | temp_sub->pos = sspUP; | |
| 11328 | ✗ | break; | |
| 11329 | |||
| 11330 | case 2: | ||
| 11331 | ✗ | temp_sub->pos = sspDOWN; | |
| 11332 | ✗ | break; | |
| 11333 | |||
| 11334 | default: | ||
| 11335 | ✗ | temp_sub->pos = 0; | |
| 11336 | ✗ | } | |
| 11337 | ✗ | } | |
| 11338 | |||
| 11339 |
1/2✓ Branch 0 taken 43106 times.
✗ Branch 1 not taken.
|
43106 | if(!p_igetw(&(temp_sub->x),f)) |
| 11340 | ✗ | return qe_invalid; | |
| 11341 | |||
| 11342 |
1/2✓ Branch 0 taken 43106 times.
✗ Branch 1 not taken.
|
43106 | if(!p_igetw(&(temp_sub->y),f)) |
| 11343 | ✗ | return qe_invalid; | |
| 11344 | |||
| 11345 |
1/2✓ Branch 0 taken 43106 times.
✗ Branch 1 not taken.
|
43106 | if(!p_igetw(&(temp_sub->w),f)) |
| 11346 | ✗ | return qe_invalid; | |
| 11347 | |||
| 11348 |
1/2✓ Branch 0 taken 43106 times.
✗ Branch 1 not taken.
|
43106 | if(!p_igetw(&(temp_sub->h),f)) |
| 11349 | ✗ | return qe_invalid; | |
| 11350 | |||
| 11351 |
1/2✓ Branch 0 taken 43106 times.
✗ Branch 1 not taken.
|
43106 | if(!p_getc(&(temp_sub->colortype1),f)) |
| 11352 | ✗ | return qe_invalid; | |
| 11353 | |||
| 11354 |
1/2✓ Branch 0 taken 43106 times.
✗ Branch 1 not taken.
|
43106 | if(!p_igetw(&(temp_sub->color1),f)) |
| 11355 | ✗ | return qe_invalid; | |
| 11356 | |||
| 11357 |
1/2✓ Branch 0 taken 43106 times.
✗ Branch 1 not taken.
|
43106 | if(!p_getc(&(temp_sub->colortype2),f)) |
| 11358 | ✗ | return qe_invalid; | |
| 11359 | |||
| 11360 |
1/2✓ Branch 0 taken 43106 times.
✗ Branch 1 not taken.
|
43106 | if(!p_igetw(&(temp_sub->color2),f)) |
| 11361 | ✗ | return qe_invalid; | |
| 11362 | |||
| 11363 |
1/2✓ Branch 0 taken 43106 times.
✗ Branch 1 not taken.
|
43106 | if(!p_getc(&(temp_sub->colortype3),f)) |
| 11364 | ✗ | return qe_invalid; | |
| 11365 | |||
| 11366 |
1/2✓ Branch 0 taken 43106 times.
✗ Branch 1 not taken.
|
43106 | if(!p_igetw(&(temp_sub->color3),f)) |
| 11367 | ✗ | return qe_invalid; | |
| 11368 | |||
| 11369 |
1/2✓ Branch 0 taken 43106 times.
✗ Branch 1 not taken.
|
43106 | if(!p_igetd(&(temp_sub->d1),f)) |
| 11370 | ✗ | return qe_invalid; | |
| 11371 | |||
| 11372 |
1/2✓ Branch 0 taken 43106 times.
✗ Branch 1 not taken.
|
43106 | if(!p_igetd(&(temp_sub->d2),f)) |
| 11373 | ✗ | return qe_invalid; | |
| 11374 | |||
| 11375 |
1/2✓ Branch 0 taken 43106 times.
✗ Branch 1 not taken.
|
43106 | if(!p_igetd(&(temp_sub->d3),f)) |
| 11376 | ✗ | return qe_invalid; | |
| 11377 | |||
| 11378 |
1/2✓ Branch 0 taken 43106 times.
✗ Branch 1 not taken.
|
43106 | if(!p_igetd(&(temp_sub->d4),f)) |
| 11379 | ✗ | return qe_invalid; | |
| 11380 | |||
| 11381 |
1/2✓ Branch 0 taken 43106 times.
✗ Branch 1 not taken.
|
43106 | if(!p_igetd(&(temp_sub->d5),f)) |
| 11382 | ✗ | return qe_invalid; | |
| 11383 | |||
| 11384 |
1/2✓ Branch 0 taken 43106 times.
✗ Branch 1 not taken.
|
43106 | if(!p_igetd(&(temp_sub->d6),f)) |
| 11385 | ✗ | return qe_invalid; | |
| 11386 | |||
| 11387 |
1/2✓ Branch 0 taken 43106 times.
✗ Branch 1 not taken.
|
43106 | if(!p_igetd(&(temp_sub->d7),f)) |
| 11388 | ✗ | return qe_invalid; | |
| 11389 | |||
| 11390 |
1/2✓ Branch 0 taken 43106 times.
✗ Branch 1 not taken.
|
43106 | if(!p_igetd(&(temp_sub->d8),f)) |
| 11391 | ✗ | return qe_invalid; | |
| 11392 | |||
| 11393 |
1/2✓ Branch 0 taken 43106 times.
✗ Branch 1 not taken.
|
43106 | if(!p_igetd(&(temp_sub->d9),f)) |
| 11394 | ✗ | return qe_invalid; | |
| 11395 | |||
| 11396 |
1/2✓ Branch 0 taken 43106 times.
✗ Branch 1 not taken.
|
43106 | if(!p_igetd(&(temp_sub->d10),f)) |
| 11397 | ✗ | return qe_invalid; | |
| 11398 | |||
| 11399 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 43106 times.
|
43106 | if(s_version < 2) |
| 11400 | { | ||
| 11401 | ✗ | if(!p_igetl(&(temp_sub->speed),f)) | |
| 11402 | ✗ | return qe_invalid; | |
| 11403 | |||
| 11404 | ✗ | if(!p_igetl(&(temp_sub->delay),f)) | |
| 11405 | ✗ | return qe_invalid; | |
| 11406 | |||
| 11407 | ✗ | if(!p_igetl(&(temp_sub->frame),f)) | |
| 11408 | ✗ | return qe_invalid; | |
| 11409 | ✗ | } | |
| 11410 | else | ||
| 11411 | { | ||
| 11412 |
1/2✓ Branch 0 taken 43106 times.
✗ Branch 1 not taken.
|
43106 | if(!p_getc(&(temp_sub->speed),f)) |
| 11413 | ✗ | return qe_invalid; | |
| 11414 | |||
| 11415 |
1/2✓ Branch 0 taken 43106 times.
✗ Branch 1 not taken.
|
43106 | if(!p_getc(&(temp_sub->delay),f)) |
| 11416 | ✗ | return qe_invalid; | |
| 11417 | |||
| 11418 |
1/2✓ Branch 0 taken 43106 times.
✗ Branch 1 not taken.
|
43106 | if(!p_igetw(&(temp_sub->frame),f)) |
| 11419 | ✗ | return qe_invalid; | |
| 11420 | } | ||
| 11421 | |||
| 11422 | 43106 | int32_t temp_size=0; | |
| 11423 | |||
| 11424 | // bool deletets = false; | ||
| 11425 |
4/4✓ Branch 0 taken 18992 times.
✓ Branch 1 taken 3250 times.
✓ Branch 2 taken 20648 times.
✓ Branch 3 taken 216 times.
|
43106 | switch(temp_sub->type) |
| 11426 | { | ||
| 11427 | case ssoTEXT: | ||
| 11428 | case ssoTEXTBOX: | ||
| 11429 | case ssoCURRENTITEMTEXT: | ||
| 11430 | case ssoCURRENTITEMCLASSTEXT: | ||
| 11431 | { | ||
| 11432 | word temptempsize; | ||
| 11433 | |||
| 11434 |
1/2✓ Branch 0 taken 3250 times.
✗ Branch 1 not taken.
|
3250 | if(!p_igetw(&temptempsize,f)) |
| 11435 | { | ||
| 11436 | ✗ | return qe_invalid; | |
| 11437 | } | ||
| 11438 | |||
| 11439 | //temptempsize = temp1 + (temp2 << 8); | ||
| 11440 | 3250 | temp_size = (int32_t)temptempsize; | |
| 11441 | 3250 | uint32_t char_length = temp_size+2; | |
| 11442 |
1/2✓ Branch 0 taken 3250 times.
✗ Branch 1 not taken.
|
3250 | if (char_length > MAX_DP1_LEN) |
| 11443 | { | ||
| 11444 | ✗ | return qe_invalid; | |
| 11445 | } | ||
| 11446 | 3250 | tempdp1[char_length - 1] = '\0'; | |
| 11447 | |||
| 11448 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 3250 times.
|
3250 | if(temp_size) |
| 11449 |
1/2✓ Branch 0 taken 3250 times.
✗ Branch 1 not taken.
|
3250 | if(!pfread(tempdp1,temp_size+1,f)) |
| 11450 | ✗ | return qe_invalid; | |
| 11451 | 3250 | break; | |
| 11452 | } | ||
| 11453 | |||
| 11454 | case ssoLIFEMETER: | ||
| 11455 |
1/2✓ Branch 0 taken 216 times.
✗ Branch 1 not taken.
|
216 | if(get_bit(deprecated_rules, 12) != 0) // qr_24HC |
| 11456 | ✗ | temp_sub->d3 = 1; | |
| 11457 | |||
| 11458 |
1/2✓ Branch 0 taken 216 times.
✗ Branch 1 not taken.
|
216 | if(!p_getc(&(temp_sub->dp1),f)) |
| 11459 | ✗ | return qe_invalid; | |
| 11460 | |||
| 11461 | 216 | break; | |
| 11462 | |||
| 11463 | |||
| 11464 | case ssoCURRENTITEM: | ||
| 11465 | |||
| 11466 |
1/2✓ Branch 0 taken 18992 times.
✗ Branch 1 not taken.
|
18992 | if(s_version < 6) |
| 11467 | { | ||
| 11468 | ✗ | switch(temp_sub->d1) | |
| 11469 | { | ||
| 11470 | case ssiBOMB: | ||
| 11471 | ✗ | temp_sub->d1 = itype_bomb; | |
| 11472 | ✗ | break; | |
| 11473 | |||
| 11474 | case ssiSWORD: | ||
| 11475 | ✗ | temp_sub->d1 = itype_sword; | |
| 11476 | ✗ | break; | |
| 11477 | |||
| 11478 | case ssiSHIELD: | ||
| 11479 | ✗ | temp_sub->d1 = itype_shield; | |
| 11480 | ✗ | break; | |
| 11481 | |||
| 11482 | case ssiCANDLE: | ||
| 11483 | ✗ | temp_sub->d1 = itype_candle; | |
| 11484 | ✗ | break; | |
| 11485 | |||
| 11486 | case ssiLETTER: | ||
| 11487 | ✗ | temp_sub->d1 = itype_letter; | |
| 11488 | ✗ | break; | |
| 11489 | |||
| 11490 | case ssiPOTION: | ||
| 11491 | ✗ | temp_sub->d1 = itype_potion; | |
| 11492 | ✗ | break; | |
| 11493 | |||
| 11494 | case ssiLETTERPOTION: | ||
| 11495 | ✗ | temp_sub->d1 = itype_letterpotion; | |
| 11496 | ✗ | break; | |
| 11497 | |||
| 11498 | case ssiBOW: | ||
| 11499 | ✗ | temp_sub->d1 = itype_bow; | |
| 11500 | ✗ | break; | |
| 11501 | |||
| 11502 | case ssiARROW: | ||
| 11503 | ✗ | temp_sub->d1 = itype_arrow; | |
| 11504 | ✗ | break; | |
| 11505 | |||
| 11506 | case ssiBOWANDARROW: | ||
| 11507 | ✗ | temp_sub->d1 = itype_bowandarrow; | |
| 11508 | ✗ | break; | |
| 11509 | |||
| 11510 | case ssiBAIT: | ||
| 11511 | ✗ | temp_sub->d1 = itype_bait; | |
| 11512 | ✗ | break; | |
| 11513 | |||
| 11514 | case ssiRING: | ||
| 11515 | ✗ | temp_sub->d1 = itype_ring; | |
| 11516 | ✗ | break; | |
| 11517 | |||
| 11518 | case ssiBRACELET: | ||
| 11519 | ✗ | temp_sub->d1 = itype_bracelet; | |
| 11520 | ✗ | break; | |
| 11521 | |||
| 11522 | case ssiMAP: | ||
| 11523 | ✗ | temp_sub->d1 = itype_map; | |
| 11524 | ✗ | break; | |
| 11525 | |||
| 11526 | case ssiCOMPASS: | ||
| 11527 | ✗ | temp_sub->d1 = itype_compass; | |
| 11528 | ✗ | break; | |
| 11529 | |||
| 11530 | case ssiBOSSKEY: | ||
| 11531 | ✗ | temp_sub->d1 = itype_bosskey; | |
| 11532 | ✗ | break; | |
| 11533 | |||
| 11534 | case ssiMAGICKEY: | ||
| 11535 | ✗ | temp_sub->d1 = itype_magickey; | |
| 11536 | ✗ | break; | |
| 11537 | |||
| 11538 | case ssiBRANG: | ||
| 11539 | ✗ | temp_sub->d1 = itype_brang; | |
| 11540 | ✗ | break; | |
| 11541 | |||
| 11542 | case ssiWAND: | ||
| 11543 | ✗ | temp_sub->d1 = itype_wand; | |
| 11544 | ✗ | break; | |
| 11545 | |||
| 11546 | case ssiRAFT: | ||
| 11547 | ✗ | temp_sub->d1 = itype_raft; | |
| 11548 | ✗ | break; | |
| 11549 | |||
| 11550 | case ssiLADDER: | ||
| 11551 | ✗ | temp_sub->d1 = itype_ladder; | |
| 11552 | ✗ | break; | |
| 11553 | |||
| 11554 | case ssiWHISTLE: | ||
| 11555 | ✗ | temp_sub->d1 = itype_whistle; | |
| 11556 | ✗ | break; | |
| 11557 | |||
| 11558 | case ssiBOOK: | ||
| 11559 | ✗ | temp_sub->d1 = itype_book; | |
| 11560 | ✗ | break; | |
| 11561 | |||
| 11562 | case ssiWALLET: | ||
| 11563 | ✗ | temp_sub->d1 = itype_wallet; | |
| 11564 | ✗ | break; | |
| 11565 | |||
| 11566 | case ssiSBOMB: | ||
| 11567 | ✗ | temp_sub->d1 = itype_sbomb; | |
| 11568 | ✗ | break; | |
| 11569 | |||
| 11570 | case ssiHCPIECE: | ||
| 11571 | ✗ | temp_sub->d1 = itype_heartpiece; | |
| 11572 | ✗ | break; | |
| 11573 | |||
| 11574 | case ssiAMULET: | ||
| 11575 | ✗ | temp_sub->d1 = itype_amulet; | |
| 11576 | ✗ | break; | |
| 11577 | |||
| 11578 | case ssiFLIPPERS: | ||
| 11579 | ✗ | temp_sub->d1 = itype_flippers; | |
| 11580 | ✗ | break; | |
| 11581 | |||
| 11582 | case ssiHOOKSHOT: | ||
| 11583 | ✗ | temp_sub->d1 = itype_hookshot; | |
| 11584 | ✗ | break; | |
| 11585 | |||
| 11586 | case ssiLENS: | ||
| 11587 | ✗ | temp_sub->d1 = itype_lens; | |
| 11588 | ✗ | break; | |
| 11589 | |||
| 11590 | case ssiHAMMER: | ||
| 11591 | ✗ | temp_sub->d1 = itype_hammer; | |
| 11592 | ✗ | break; | |
| 11593 | |||
| 11594 | case ssiBOOTS: | ||
| 11595 | ✗ | temp_sub->d1 = itype_boots; | |
| 11596 | ✗ | break; | |
| 11597 | |||
| 11598 | case ssiDIVINEFIRE: | ||
| 11599 | ✗ | temp_sub->d1 = itype_divinefire; | |
| 11600 | ✗ | break; | |
| 11601 | |||
| 11602 | case ssiDIVINEESCAPE: | ||
| 11603 | ✗ | temp_sub->d1 = itype_divineescape; | |
| 11604 | ✗ | break; | |
| 11605 | |||
| 11606 | case ssiDIVINEPROTECTION: | ||
| 11607 | ✗ | temp_sub->d1 = itype_divineprotection; | |
| 11608 | ✗ | break; | |
| 11609 | |||
| 11610 | case ssiQUIVER: | ||
| 11611 | ✗ | temp_sub->d1 = itype_quiver; | |
| 11612 | ✗ | break; | |
| 11613 | |||
| 11614 | case ssiBOMBBAG: | ||
| 11615 | ✗ | temp_sub->d1 = itype_bombbag; | |
| 11616 | ✗ | break; | |
| 11617 | |||
| 11618 | case ssiCBYRNA: | ||
| 11619 | ✗ | temp_sub->d1 = itype_cbyrna; | |
| 11620 | ✗ | break; | |
| 11621 | |||
| 11622 | case ssiROCS: | ||
| 11623 | ✗ | temp_sub->d1 = itype_rocs; | |
| 11624 | ✗ | break; | |
| 11625 | |||
| 11626 | case ssiHOVERBOOTS: | ||
| 11627 | ✗ | temp_sub->d1 = itype_hoverboots; | |
| 11628 | ✗ | break; | |
| 11629 | |||
| 11630 | case ssiSPINSCROLL: | ||
| 11631 | ✗ | temp_sub->d1 = itype_spinscroll; | |
| 11632 | ✗ | break; | |
| 11633 | |||
| 11634 | case ssiCROSSSCROLL: | ||
| 11635 | ✗ | temp_sub->d1 = itype_crossscroll; | |
| 11636 | ✗ | break; | |
| 11637 | |||
| 11638 | case ssiQUAKESCROLL: | ||
| 11639 | ✗ | temp_sub->d1 = itype_quakescroll; | |
| 11640 | ✗ | break; | |
| 11641 | |||
| 11642 | case ssiWHISPRING: | ||
| 11643 | ✗ | temp_sub->d1 = itype_whispring; | |
| 11644 | ✗ | break; | |
| 11645 | |||
| 11646 | case ssiCHARGERING: | ||
| 11647 | ✗ | temp_sub->d1 = itype_chargering; | |
| 11648 | ✗ | break; | |
| 11649 | |||
| 11650 | case ssiPERILSCROLL: | ||
| 11651 | ✗ | temp_sub->d1 = itype_perilscroll; | |
| 11652 | ✗ | break; | |
| 11653 | |||
| 11654 | case ssiWEALTHMEDAL: | ||
| 11655 | ✗ | temp_sub->d1 = itype_wealthmedal; | |
| 11656 | ✗ | break; | |
| 11657 | |||
| 11658 | case ssiHEARTRING: | ||
| 11659 | ✗ | temp_sub->d1 = itype_heartring; | |
| 11660 | ✗ | break; | |
| 11661 | |||
| 11662 | case ssiMAGICRING: | ||
| 11663 | ✗ | temp_sub->d1 = itype_magicring; | |
| 11664 | ✗ | break; | |
| 11665 | |||
| 11666 | case ssiSPINSCROLL2: | ||
| 11667 | ✗ | temp_sub->d1 = itype_spinscroll2; | |
| 11668 | ✗ | break; | |
| 11669 | |||
| 11670 | case ssiQUAKESCROLL2: | ||
| 11671 | ✗ | temp_sub->d1 = itype_quakescroll2; | |
| 11672 | ✗ | break; | |
| 11673 | |||
| 11674 | case ssiAGONY: | ||
| 11675 | ✗ | temp_sub->d1 = itype_agony; | |
| 11676 | ✗ | break; | |
| 11677 | |||
| 11678 | case ssiSTOMPBOOTS: | ||
| 11679 | ✗ | temp_sub->d1 = itype_stompboots; | |
| 11680 | ✗ | break; | |
| 11681 | |||
| 11682 | case ssiWHIMSICALRING: | ||
| 11683 | ✗ | temp_sub->d1 = itype_whimsicalring; | |
| 11684 | ✗ | break; | |
| 11685 | |||
| 11686 | case ssiPERILRING: | ||
| 11687 | ✗ | temp_sub->d1 = itype_perilring; | |
| 11688 | ✗ | break; | |
| 11689 | |||
| 11690 | default: | ||
| 11691 | ✗ | temp_sub->d1 += itype_custom1 - ssiMAX; | |
| 11692 | ✗ | } | |
| 11693 | ✗ | } | |
| 11694 | |||
| 11695 | //fall-through | ||
| 11696 | default: | ||
| 11697 |
1/2✓ Branch 0 taken 39640 times.
✗ Branch 1 not taken.
|
39640 | if(!p_getc(&(temp_sub->dp1),f)) |
| 11698 | ✗ | return qe_invalid; | |
| 11699 | |||
| 11700 | 39640 | break; | |
| 11701 | } | ||
| 11702 | |||
| 11703 |
2/2✓ Branch 0 taken 9237 times.
✓ Branch 1 taken 33869 times.
|
43106 | if(s_version < 7) |
| 11704 | { | ||
| 11705 |
3/3✓ Branch 0 taken 27879 times.
✓ Branch 1 taken 1366 times.
✓ Branch 2 taken 4624 times.
|
33869 | switch(temp_sub->type) |
| 11706 | { | ||
| 11707 | case ssoMAGICGAUGE: | ||
| 11708 | { | ||
| 11709 |
2/2✓ Branch 0 taken 118 times.
✓ Branch 1 taken 1248 times.
|
1366 | if(!temp_sub->d9) |
| 11710 | 1248 | temp_sub->d9 = -1; //-1 now represents 'always' | |
| 11711 | 1366 | break; | |
| 11712 | } | ||
| 11713 | case ssoLIFEGAUGE: | ||
| 11714 | 4624 | temp_sub->d9 = 0; //Unused, doesn't do anything? Clear it... | |
| 11715 | 4624 | break; | |
| 11716 | } | ||
| 11717 | 33869 | } | |
| 11718 | |||
| 11719 |
3/3✓ Branch 0 taken 3250 times.
✓ Branch 1 taken 38354 times.
✓ Branch 2 taken 1502 times.
|
43106 | switch(temp_sub->type) |
| 11720 | { | ||
| 11721 | case ssoTEXT: | ||
| 11722 | case ssoTEXTBOX: | ||
| 11723 | case ssoCURRENTITEMTEXT: | ||
| 11724 | case ssoCURRENTITEMCLASSTEXT: | ||
| 11725 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 3250 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
3250 | if(g->objects[j].dp1 != NULL) delete[](char *)g->objects[j].dp1; |
| 11726 | |||
| 11727 | 3250 | memcpy(&g->objects[j],temp_sub,sizeof(subscreen_object)); | |
| 11728 | 3250 | g->objects[j].dp1 = new char[temp_size+2]; | |
| 11729 | 3250 | strcpy((char*)g->objects[j].dp1,tempdp1); | |
| 11730 | 3250 | break; | |
| 11731 | |||
| 11732 | case ssoCOUNTER: | ||
| 11733 |
1/2✓ Branch 0 taken 1502 times.
✗ Branch 1 not taken.
|
1502 | if(s_version<3) |
| 11734 | { | ||
| 11735 | ✗ | temp_sub->d6=(temp_sub->d6?1:0)+(temp_sub->d8?2:0); | |
| 11736 | ✗ | temp_sub->d8=0; | |
| 11737 | ✗ | } | |
| 11738 | |||
| 11739 | default: | ||
| 11740 | 39856 | memcpy(&g->objects[j],temp_sub,sizeof(subscreen_object)); | |
| 11741 | 39856 | break; | |
| 11742 | } | ||
| 11743 | |||
| 11744 | 43106 | g->name[0] = '\0'; | |
| 11745 | 43106 | strncat(g->name, tempname, 64 - 1); | |
| 11746 | 43106 | g->ss_type = temp_ss; | |
| 11747 | 43106 | } | |
| 11748 | |||
| 11749 |
2/2✓ Branch 0 taken 6739870 times.
✓ Branch 1 taken 26496 times.
|
6766366 | for(j=numsub; j<MAXSUBSCREENITEMS; j++) |
| 11750 | { | ||
| 11751 | //clear all unused object in this subscreen -DD | ||
| 11752 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 6739870 times.
|
6739870 | switch(g->objects[j].type) |
| 11753 | { | ||
| 11754 | case ssoTEXT: | ||
| 11755 | case ssoTEXTBOX: | ||
| 11756 | case ssoCURRENTITEMTEXT: | ||
| 11757 | case ssoCURRENTITEMCLASSTEXT: | ||
| 11758 | ✗ | if(g->objects[j].dp1 != NULL) delete [](char *)g->objects[j].dp1; | |
| 11759 | |||
| 11760 | //fall through | ||
| 11761 | default: | ||
| 11762 | 6739870 | memset(&g->objects[j],0,sizeof(subscreen_object)); | |
| 11763 | 6739870 | break; | |
| 11764 | } | ||
| 11765 | 6739870 | } | |
| 11766 | |||
| 11767 | 26496 | return 0; | |
| 11768 | 26496 | } | |
| 11769 | |||
| 11770 | 612 | int32_t readsubscreens(PACKFILE *f) | |
| 11771 | { | ||
| 11772 | word s_version, s_cversion; | ||
| 11773 | dword dummy; | ||
| 11774 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 612 times.
|
612 | if(!p_igetw(&s_version,f)) |
| 11775 | ✗ | return qe_invalid; | |
| 11776 | 612 | FFCore.quest_format[vSubscreen] = s_version; | |
| 11777 |
1/2✓ Branch 0 taken 612 times.
✗ Branch 1 not taken.
|
612 | if(!p_igetw(&s_cversion,f)) |
| 11778 | ✗ | return qe_invalid; | |
| 11779 |
1/2✓ Branch 0 taken 612 times.
✗ Branch 1 not taken.
|
612 | if(!p_igetl(&dummy,f)) //section size |
| 11780 | ✗ | return qe_invalid; | |
| 11781 | |||
| 11782 |
2/2✓ Branch 0 taken 207 times.
✓ Branch 1 taken 405 times.
|
612 | if(s_version < 8) |
| 11783 | 207 | return read_old_subscreens(f,s_version); | |
| 11784 | |||
| 11785 | 405 | subscreens_active.clear(); | |
| 11786 | 405 | subscreens_passive.clear(); | |
| 11787 | 405 | subscreens_overlay.clear(); | |
| 11788 | |||
| 11789 | byte sz; | ||
| 11790 |
1/2✓ Branch 0 taken 405 times.
✗ Branch 1 not taken.
|
405 | if(!p_getc(&sz,f)) |
| 11791 | ✗ | return qe_invalid; | |
| 11792 |
2/2✓ Branch 0 taken 777 times.
✓ Branch 1 taken 405 times.
|
1182 | for(byte q = 0; q < sz; ++q) |
| 11793 | { | ||
| 11794 | 777 | ZCSubscreen& tmp = subscreens_active.emplace_back(); | |
| 11795 |
1/2✓ Branch 0 taken 777 times.
✗ Branch 1 not taken.
|
777 | if (auto ret = tmp.read(f, s_version)) |
| 11796 | ✗ | return ret; | |
| 11797 | 777 | } | |
| 11798 |
1/2✓ Branch 0 taken 405 times.
✗ Branch 1 not taken.
|
405 | if(!p_getc(&sz,f)) |
| 11799 | ✗ | return qe_invalid; | |
| 11800 |
2/2✓ Branch 0 taken 1584 times.
✓ Branch 1 taken 405 times.
|
1989 | for(byte q = 0; q < sz; ++q) |
| 11801 | { | ||
| 11802 | 1584 | ZCSubscreen& tmp = subscreens_passive.emplace_back(); | |
| 11803 |
1/2✓ Branch 0 taken 1584 times.
✗ Branch 1 not taken.
|
1584 | if (auto ret = tmp.read(f, s_version)) |
| 11804 | ✗ | return ret; | |
| 11805 | 1584 | } | |
| 11806 |
1/2✓ Branch 0 taken 405 times.
✗ Branch 1 not taken.
|
405 | if(!p_getc(&sz,f)) |
| 11807 | ✗ | return qe_invalid; | |
| 11808 |
2/2✓ Branch 0 taken 552 times.
✓ Branch 1 taken 405 times.
|
957 | for(byte q = 0; q < sz; ++q) |
| 11809 | { | ||
| 11810 | 552 | ZCSubscreen& tmp = subscreens_overlay.emplace_back(); | |
| 11811 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 552 times.
|
552 | if (auto ret = tmp.read(f, s_version)) |
| 11812 | ✗ | return ret; | |
| 11813 | 552 | } | |
| 11814 | 405 | return 0; | |
| 11815 | 612 | } | |
| 11816 | |||
| 11817 | ✗ | void reset_subscreen(subscreen_group *tempss) | |
| 11818 | { | ||
| 11819 | ✗ | for(int32_t i=0; i<MAXSUBSCREENITEMS; ++i) | |
| 11820 | { | ||
| 11821 | ✗ | switch(tempss->objects[i].type) | |
| 11822 | { | ||
| 11823 | case ssoTEXT: | ||
| 11824 | case ssoTEXTBOX: | ||
| 11825 | case ssoCURRENTITEMTEXT: | ||
| 11826 | case ssoCURRENTITEMCLASSTEXT: | ||
| 11827 | ✗ | if(tempss->objects[i].dp1 != NULL) delete [](char *)tempss->objects[i].dp1; | |
| 11828 | |||
| 11829 | //fall through | ||
| 11830 | default: | ||
| 11831 | ✗ | memset(&tempss->objects[i],0,sizeof(subscreen_object)); | |
| 11832 | ✗ | break; | |
| 11833 | } | ||
| 11834 | ✗ | } | |
| 11835 | ✗ | } | |
| 11836 | |||
| 11837 | 107 | void reset_subscreens() | |
| 11838 | { | ||
| 11839 | 107 | subscreens_active.clear(); | |
| 11840 | 107 | subscreens_passive.clear(); | |
| 11841 | 107 | subscreens_overlay.clear(); | |
| 11842 | 107 | } | |
| 11843 | |||
| 11844 | 107 | int32_t setupsubscreens() | |
| 11845 | { | ||
| 11846 | 107 | reset_subscreens(); | |
| 11847 | //return 0; | ||
| 11848 |
2/2✓ Branch 0 taken 107 times.
✓ Branch 1 taken 214 times.
|
321 | for(int q = 0; q < 2; ++q) |
| 11849 | { | ||
| 11850 | 214 | subscreens_active.emplace_back(); | |
| 11851 | 214 | subscreens_passive.emplace_back(); | |
| 11852 | 214 | } | |
| 11853 | 107 | int32_t tempsubscreen=subscr_mode; | |
| 11854 | |||
| 11855 |
1/2✓ Branch 0 taken 107 times.
✗ Branch 1 not taken.
|
107 | if(tempsubscreen>=ssdtMAX) |
| 11856 | ✗ | tempsubscreen=0; | |
| 11857 | |||
| 11858 |
1/3✗ Branch 0 not taken.
✓ Branch 1 taken 107 times.
✗ Branch 2 not taken.
|
107 | switch(tempsubscreen) |
| 11859 | { | ||
| 11860 | case ssdtOLD: | ||
| 11861 | case ssdtNEWSUBSCR: | ||
| 11862 | case ssdtREV2: | ||
| 11863 | case ssdtBSZELDA: | ||
| 11864 | case ssdtBSZELDAMODIFIED: | ||
| 11865 | case ssdtBSZELDAENHANCED: | ||
| 11866 | case ssdtBSZELDACOMPLETE: | ||
| 11867 | { | ||
| 11868 | 107 | subscreens_active[0].load_old(default_subscreen_active[tempsubscreen][0]); | |
| 11869 | 107 | subscreens_active[0].sub_type=sstACTIVE; | |
| 11870 | 107 | subscreens_active[0].name = "Active Subscreen (Triforce)"; | |
| 11871 | 107 | subscreens_active[1].load_old(default_subscreen_active[tempsubscreen][1]); | |
| 11872 | 107 | subscreens_active[1].sub_type=sstACTIVE; | |
| 11873 | 107 | subscreens_active[1].name = "Active Subscreen (Dungeon Map)"; | |
| 11874 | 107 | subscreens_passive[0].load_old(default_subscreen_passive[tempsubscreen][0]); | |
| 11875 | 107 | subscreens_passive[0].sub_type=sstPASSIVE; | |
| 11876 | 107 | subscreens_passive[0].name = "Passive Subscreen (Magic)"; | |
| 11877 | 107 | subscreens_passive[1].load_old(default_subscreen_passive[tempsubscreen][1]); | |
| 11878 | 107 | subscreens_passive[1].sub_type=sstPASSIVE; | |
| 11879 | 107 | subscreens_passive[1].name = "Passive Subscreen (No Magic)"; | |
| 11880 | 107 | break; | |
| 11881 | } | ||
| 11882 | |||
| 11883 | case ssdtZ3: | ||
| 11884 | { | ||
| 11885 | ✗ | subscreens_active[0].load_old(z3_active_a); | |
| 11886 | ✗ | subscreens_active[0].sub_type=sstACTIVE; | |
| 11887 | ✗ | subscreens_active[1].load_old(z3_active_ab); | |
| 11888 | ✗ | subscreens_active[1].sub_type=sstACTIVE; | |
| 11889 | ✗ | subscreens_passive[0].load_old(z3_passive_a); | |
| 11890 | ✗ | subscreens_passive[0].sub_type=sstPASSIVE; | |
| 11891 | ✗ | subscreens_passive[1].load_old(z3_passive_ab); | |
| 11892 | ✗ | subscreens_passive[1].sub_type=sstPASSIVE; | |
| 11893 | ✗ | break; | |
| 11894 | } | ||
| 11895 | } | ||
| 11896 | 107 | subscr_mode = ssdtMAX; | |
| 11897 | 107 | return 0; | |
| 11898 | } | ||
| 11899 | |||
| 11900 | extern std::vector<std::shared_ptr<zasm_script>> zasm_scripts; | ||
| 11901 | |||
| 11902 | extern script_data *ffscripts[NUMSCRIPTFFC]; | ||
| 11903 | extern script_data *itemscripts[NUMSCRIPTITEM]; | ||
| 11904 | extern script_data *guyscripts[NUMSCRIPTGUYS]; | ||
| 11905 | extern script_data *lwpnscripts[NUMSCRIPTWEAPONS]; | ||
| 11906 | extern script_data *ewpnscripts[NUMSCRIPTWEAPONS]; | ||
| 11907 | extern script_data *globalscripts[NUMSCRIPTGLOBAL]; | ||
| 11908 | extern script_data *genericscripts[NUMSCRIPTSGENERIC]; | ||
| 11909 | extern script_data *playerscripts[NUMSCRIPTPLAYER]; | ||
| 11910 | extern script_data *screenscripts[NUMSCRIPTSCREEN]; | ||
| 11911 | extern script_data *dmapscripts[NUMSCRIPTSDMAP]; | ||
| 11912 | extern script_data *itemspritescripts[NUMSCRIPTSITEMSPRITE]; | ||
| 11913 | extern script_data *comboscripts[NUMSCRIPTSCOMBODATA]; | ||
| 11914 | extern script_data *subscreenscripts[NUMSCRIPTSSUBSCREEN]; | ||
| 11915 | |||
| 11916 | static std::vector<const script_data*> read_scripts; | ||
| 11917 | |||
| 11918 | 1086 | int32_t readffscript(PACKFILE *f, zquestheader *Header) | |
| 11919 | { | ||
| 11920 | int32_t dummy; | ||
| 11921 | 1086 | word s_version=0, s_cversion=0, zmeta_version=0; | |
| 11922 | 1086 | byte numscripts=0; | |
| 11923 | 1086 | numscripts=numscripts; //to avoid unused variables warnings | |
| 11924 | int32_t ret; | ||
| 11925 | 1086 | read_scripts.clear(); | |
| 11926 | 1086 | zasm_scripts.clear(); | |
| 11927 | |||
| 11928 | //section version info | ||
| 11929 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1086 times.
|
1086 | if(!p_igetw(&s_version,f)) |
| 11930 | { | ||
| 11931 | ✗ | return qe_invalid; | |
| 11932 | } | ||
| 11933 | |||
| 11934 | 1086 | FFCore.quest_format[vFFScript] = s_version; | |
| 11935 | |||
| 11936 |
1/2✓ Branch 0 taken 1086 times.
✗ Branch 1 not taken.
|
1086 | if(!p_igetw(&s_cversion,f)) |
| 11937 | { | ||
| 11938 | ✗ | return qe_invalid; | |
| 11939 | } | ||
| 11940 | |||
| 11941 |
2/2✓ Branch 0 taken 663 times.
✓ Branch 1 taken 423 times.
|
1086 | if(s_version >= 18) |
| 11942 | { | ||
| 11943 |
1/2✓ Branch 0 taken 423 times.
✗ Branch 1 not taken.
|
423 | if(!p_igetw(&zmeta_version,f)) |
| 11944 | { | ||
| 11945 | ✗ | return qe_invalid; | |
| 11946 | } | ||
| 11947 | 423 | } | |
| 11948 | |||
| 11949 | //al_trace("Scripts version %d\n", s_version); | ||
| 11950 | //section size | ||
| 11951 |
1/2✓ Branch 0 taken 1086 times.
✗ Branch 1 not taken.
|
1086 | if(!p_igetl(&dummy,f)) |
| 11952 | { | ||
| 11953 | ✗ | return qe_invalid; | |
| 11954 | } | ||
| 11955 | |||
| 11956 |
2/2✓ Branch 0 taken 879 times.
✓ Branch 1 taken 207 times.
|
1086 | if ( FFCore.quest_format[vLastCompile] < 13 ) FFCore.quest_format[vLastCompile] = s_version; |
| 11957 | 1086 | al_trace("Loaded scripts last compiled in ZScript version: %d\n", (FFCore.quest_format[vLastCompile])); | |
| 11958 | |||
| 11959 | //finally... section data | ||
| 11960 |
2/2✓ Branch 0 taken 313344 times.
✓ Branch 1 taken 1080 times.
|
314430 | for(int32_t i = 0; i < ((s_version < 2) ? NUMSCRIPTFFCOLD : NUMSCRIPTFFC); i++) |
| 11961 | { | ||
| 11962 | 313344 | ret = read_one_ffscript(f, Header, i, s_version, s_cversion, &ffscripts[i], zmeta_version); | |
| 11963 | |||
| 11964 |
1/2✓ Branch 0 taken 313344 times.
✗ Branch 1 not taken.
|
313344 | if (ret) |
| 11965 | { | ||
| 11966 | ✗ | return qe_invalid; | |
| 11967 | } | ||
| 11968 | 313344 | } | |
| 11969 | |||
| 11970 | /* HIGHLY UNORTHODOX UPDATING THING, by Deedee | ||
| 11971 | * This fixes changes to sprite jump values introduced in early 2.55 alphas. | ||
| 11972 | * Zoria didn't bump up the versions as liberally as he should have, but thankfully | ||
| 11973 | * there was a version bump a week before a change that broke stuff. | ||
| 11974 | */ | ||
| 11975 |
7/8✓ Branch 0 taken 423 times.
✓ Branch 1 taken 657 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 423 times.
✓ Branch 4 taken 423 times.
✓ Branch 5 taken 423 times.
✓ Branch 6 taken 423 times.
✓ Branch 7 taken 423 times.
|
1080 | if(((Header->zelda_version < 0x253)||((Header->zelda_version == 0x253)&&(Header->build<33))||((Header->zelda_version > 0x253) && s_version < 12))) |
| 11976 | { | ||
| 11977 | 1503 | set_qr(qr_SPRITE_JUMP_IS_TRUNCATED,1); | |
| 11978 | 1503 | } | |
| 11979 |
2/2✓ Branch 0 taken 423 times.
✓ Branch 1 taken 189 times.
|
612 | if(s_version < 19) |
| 11980 | { | ||
| 11981 | 189 | set_qr(qr_FLUCTUATING_ENEMY_JUMP,1); | |
| 11982 | 189 | } | |
| 11983 | |||
| 11984 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 612 times.
|
612 | if(s_version > 1) |
| 11985 | { | ||
| 11986 |
2/2✓ Branch 0 taken 156672 times.
✓ Branch 1 taken 612 times.
|
157284 | for(int32_t i = 0; i < NUMSCRIPTITEM; i++) |
| 11987 | { | ||
| 11988 | 156672 | ret = read_one_ffscript(f, Header, i, s_version, s_cversion, &itemscripts[i], zmeta_version); | |
| 11989 | |||
| 11990 |
1/2✓ Branch 0 taken 156672 times.
✗ Branch 1 not taken.
|
156672 | if (ret) |
| 11991 | { | ||
| 11992 | ✗ | return qe_invalid; | |
| 11993 | } | ||
| 11994 | 156672 | } | |
| 11995 | |||
| 11996 |
2/2✓ Branch 0 taken 156672 times.
✓ Branch 1 taken 612 times.
|
157284 | for(int32_t i = 0; i < NUMSCRIPTGUYS; i++) |
| 11997 | { | ||
| 11998 | 156672 | ret = read_one_ffscript(f, Header, i, s_version, s_cversion, &guyscripts[i], zmeta_version); | |
| 11999 | |||
| 12000 |
1/2✓ Branch 0 taken 156672 times.
✗ Branch 1 not taken.
|
156672 | if (ret) |
| 12001 | { | ||
| 12002 | ✗ | return qe_invalid; | |
| 12003 | } | ||
| 12004 | 156672 | } | |
| 12005 | |||
| 12006 |
1/2✓ Branch 0 taken 612 times.
✗ Branch 1 not taken.
|
612 | script_data *fake = new script_data(ScriptType::None, 0); |
| 12007 |
2/2✓ Branch 0 taken 156672 times.
✓ Branch 1 taken 612 times.
|
157284 | for(int32_t i = 0; i < NUMSCRIPTWEAPONS; i++) |
| 12008 | { | ||
| 12009 | 156672 | ret = read_one_ffscript(f, Header, i, s_version, s_cversion, &fake, zmeta_version); | |
| 12010 | |||
| 12011 |
1/2✓ Branch 0 taken 156672 times.
✗ Branch 1 not taken.
|
156672 | if (ret) |
| 12012 | { | ||
| 12013 | ✗ | return qe_invalid; | |
| 12014 | } | ||
| 12015 | 156672 | } | |
| 12016 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 612 times.
|
612 | delete fake; |
| 12017 | |||
| 12018 |
2/2✓ Branch 0 taken 156672 times.
✓ Branch 1 taken 612 times.
|
157284 | for(int32_t i = 0; i < NUMSCRIPTSCREEN; i++) |
| 12019 | { | ||
| 12020 | 156672 | ret = read_one_ffscript(f, Header, i, s_version, s_cversion, &screenscripts[i], zmeta_version); | |
| 12021 | |||
| 12022 |
1/2✓ Branch 0 taken 156672 times.
✗ Branch 1 not taken.
|
156672 | if (ret) |
| 12023 | { | ||
| 12024 | ✗ | return qe_invalid; | |
| 12025 | } | ||
| 12026 | 156672 | } | |
| 12027 | |||
| 12028 |
2/2✓ Branch 0 taken 423 times.
✓ Branch 1 taken 189 times.
|
612 | if(s_version > 16) |
| 12029 | { | ||
| 12030 |
2/2✓ Branch 0 taken 3384 times.
✓ Branch 1 taken 423 times.
|
3807 | for(int32_t i = 0; i < NUMSCRIPTGLOBAL; ++i) |
| 12031 | { | ||
| 12032 | 3384 | ret = read_one_ffscript(f, Header, i, s_version, s_cversion, &globalscripts[i], zmeta_version); | |
| 12033 | |||
| 12034 |
1/2✓ Branch 0 taken 3384 times.
✗ Branch 1 not taken.
|
3384 | if (ret) |
| 12035 | { | ||
| 12036 | ✗ | return qe_invalid; | |
| 12037 | } | ||
| 12038 | 3384 | } | |
| 12039 | 423 | } | |
| 12040 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 189 times.
|
189 | else if(s_version > 13) |
| 12041 | { | ||
| 12042 | ✗ | for(int32_t i = 0; i < NUMSCRIPTGLOBAL255OLD; ++i) | |
| 12043 | { | ||
| 12044 | ✗ | ret = read_one_ffscript(f, Header, i, s_version, s_cversion, &globalscripts[i], zmeta_version); | |
| 12045 | |||
| 12046 | ✗ | if (ret) | |
| 12047 | { | ||
| 12048 | ✗ | return qe_invalid; | |
| 12049 | } | ||
| 12050 | ✗ | } | |
| 12051 | |||
| 12052 | ✗ | if(globalscripts[GLOBAL_SCRIPT_ONSAVE] != NULL) | |
| 12053 | ✗ | delete globalscripts[GLOBAL_SCRIPT_ONSAVE]; | |
| 12054 | |||
| 12055 | ✗ | globalscripts[GLOBAL_SCRIPT_ONSAVE] = new script_data(ScriptType::Global, GLOBAL_SCRIPT_ONSAVE); | |
| 12056 | ✗ | } | |
| 12057 |
1/2✓ Branch 0 taken 189 times.
✗ Branch 1 not taken.
|
189 | else if(s_version > 4) |
| 12058 | { | ||
| 12059 |
2/2✓ Branch 0 taken 756 times.
✓ Branch 1 taken 189 times.
|
945 | for(int32_t i = 0; i < NUMSCRIPTGLOBAL253; ++i) |
| 12060 | { | ||
| 12061 | 756 | ret = read_one_ffscript(f, Header, i, s_version, s_cversion, &globalscripts[i], zmeta_version); | |
| 12062 | |||
| 12063 |
1/2✓ Branch 0 taken 756 times.
✗ Branch 1 not taken.
|
756 | if (ret) |
| 12064 | { | ||
| 12065 | ✗ | return qe_invalid; | |
| 12066 | } | ||
| 12067 | 756 | } | |
| 12068 | |||
| 12069 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 189 times.
|
189 | if(globalscripts[GLOBAL_SCRIPT_ONLAUNCH] != NULL) |
| 12070 |
1/2✓ Branch 0 taken 189 times.
✗ Branch 1 not taken.
|
189 | delete globalscripts[GLOBAL_SCRIPT_ONLAUNCH]; |
| 12071 | |||
| 12072 |
1/2✓ Branch 0 taken 189 times.
✗ Branch 1 not taken.
|
189 | globalscripts[GLOBAL_SCRIPT_ONLAUNCH] = new script_data(ScriptType::Global, GLOBAL_SCRIPT_ONLAUNCH); |
| 12073 | |||
| 12074 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 189 times.
|
189 | if(globalscripts[GLOBAL_SCRIPT_ONCONTGAME] != NULL) |
| 12075 |
1/2✓ Branch 0 taken 189 times.
✗ Branch 1 not taken.
|
189 | delete globalscripts[GLOBAL_SCRIPT_ONCONTGAME]; |
| 12076 | |||
| 12077 |
1/2✓ Branch 0 taken 189 times.
✗ Branch 1 not taken.
|
189 | globalscripts[GLOBAL_SCRIPT_ONCONTGAME] = new script_data(ScriptType::Global, GLOBAL_SCRIPT_ONCONTGAME); |
| 12078 | |||
| 12079 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 189 times.
|
189 | if(globalscripts[GLOBAL_SCRIPT_F6] != NULL) |
| 12080 |
1/2✓ Branch 0 taken 189 times.
✗ Branch 1 not taken.
|
189 | delete globalscripts[GLOBAL_SCRIPT_F6]; |
| 12081 | |||
| 12082 |
1/2✓ Branch 0 taken 189 times.
✗ Branch 1 not taken.
|
189 | globalscripts[GLOBAL_SCRIPT_F6] = new script_data(ScriptType::Global, GLOBAL_SCRIPT_F6); |
| 12083 | |||
| 12084 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 189 times.
|
189 | if(globalscripts[GLOBAL_SCRIPT_ONSAVE] != NULL) |
| 12085 |
1/2✓ Branch 0 taken 189 times.
✗ Branch 1 not taken.
|
189 | delete globalscripts[GLOBAL_SCRIPT_ONSAVE]; |
| 12086 | |||
| 12087 |
1/2✓ Branch 0 taken 189 times.
✗ Branch 1 not taken.
|
189 | globalscripts[GLOBAL_SCRIPT_ONSAVE] = new script_data(ScriptType::Global, GLOBAL_SCRIPT_ONSAVE); |
| 12088 | 189 | } | |
| 12089 | else | ||
| 12090 | { | ||
| 12091 | ✗ | for(int32_t i = 0; i < NUMSCRIPTGLOBALOLD; i++) | |
| 12092 | { | ||
| 12093 | ✗ | ret = read_one_ffscript(f, Header, i, s_version, s_cversion, &globalscripts[i], zmeta_version); | |
| 12094 | |||
| 12095 | ✗ | if (ret) | |
| 12096 | { | ||
| 12097 | ✗ | return qe_invalid; | |
| 12098 | } | ||
| 12099 | ✗ | } | |
| 12100 | |||
| 12101 | ✗ | if(globalscripts[GLOBAL_SCRIPT_ONSAVELOAD] != NULL) | |
| 12102 | ✗ | delete globalscripts[GLOBAL_SCRIPT_ONSAVELOAD]; | |
| 12103 | |||
| 12104 | ✗ | globalscripts[GLOBAL_SCRIPT_ONSAVELOAD] = new script_data(ScriptType::Global, GLOBAL_SCRIPT_ONSAVELOAD); | |
| 12105 | |||
| 12106 | ✗ | if(globalscripts[GLOBAL_SCRIPT_ONLAUNCH] != NULL) | |
| 12107 | ✗ | delete globalscripts[GLOBAL_SCRIPT_ONLAUNCH]; | |
| 12108 | |||
| 12109 | ✗ | globalscripts[GLOBAL_SCRIPT_ONLAUNCH] = new script_data(ScriptType::Global, GLOBAL_SCRIPT_ONLAUNCH); | |
| 12110 | |||
| 12111 | ✗ | if(globalscripts[GLOBAL_SCRIPT_ONCONTGAME] != NULL) | |
| 12112 | ✗ | delete globalscripts[GLOBAL_SCRIPT_ONCONTGAME]; | |
| 12113 | |||
| 12114 | ✗ | globalscripts[GLOBAL_SCRIPT_ONCONTGAME] = new script_data(ScriptType::Global, GLOBAL_SCRIPT_ONCONTGAME); | |
| 12115 | |||
| 12116 | ✗ | if(globalscripts[GLOBAL_SCRIPT_F6] != NULL) | |
| 12117 | ✗ | delete globalscripts[GLOBAL_SCRIPT_F6]; | |
| 12118 | |||
| 12119 | ✗ | globalscripts[GLOBAL_SCRIPT_F6] = new script_data(ScriptType::Global, GLOBAL_SCRIPT_F6); | |
| 12120 | |||
| 12121 | ✗ | if(globalscripts[GLOBAL_SCRIPT_ONSAVE] != NULL) | |
| 12122 | ✗ | delete globalscripts[GLOBAL_SCRIPT_ONSAVE]; | |
| 12123 | |||
| 12124 | ✗ | globalscripts[GLOBAL_SCRIPT_ONSAVE] = new script_data(ScriptType::Global, GLOBAL_SCRIPT_ONSAVE); | |
| 12125 | } | ||
| 12126 | |||
| 12127 |
2/2✓ Branch 0 taken 423 times.
✓ Branch 1 taken 189 times.
|
612 | if(s_version > 10) //expanded the number of Player scripts to 5. |
| 12128 | { | ||
| 12129 |
2/2✓ Branch 0 taken 2115 times.
✓ Branch 1 taken 423 times.
|
2538 | for(int32_t i = 0; i < NUMSCRIPTPLAYER; i++) |
| 12130 | { | ||
| 12131 | 2115 | ret = read_one_ffscript(f, Header, i, s_version, s_cversion, &playerscripts[i], zmeta_version); | |
| 12132 | |||
| 12133 |
1/2✓ Branch 0 taken 2115 times.
✗ Branch 1 not taken.
|
2115 | if (ret) |
| 12134 | { | ||
| 12135 | ✗ | return qe_invalid; | |
| 12136 | } | ||
| 12137 | 2115 | } | |
| 12138 | 423 | } | |
| 12139 | else | ||
| 12140 | { | ||
| 12141 |
2/2✓ Branch 0 taken 567 times.
✓ Branch 1 taken 189 times.
|
756 | for(int32_t i = 0; i < NUMSCRIPTHEROOLD; i++) |
| 12142 | { | ||
| 12143 | 567 | ret = read_one_ffscript(f, Header, i, s_version, s_cversion, &playerscripts[i], zmeta_version); | |
| 12144 | |||
| 12145 |
1/2✓ Branch 0 taken 567 times.
✗ Branch 1 not taken.
|
567 | if (ret) |
| 12146 | { | ||
| 12147 | ✗ | return qe_invalid; | |
| 12148 | } | ||
| 12149 | 567 | } | |
| 12150 |
1/2✓ Branch 0 taken 189 times.
✗ Branch 1 not taken.
|
189 | if(playerscripts[3] != NULL) |
| 12151 |
1/2✓ Branch 0 taken 189 times.
✗ Branch 1 not taken.
|
189 | delete playerscripts[3]; |
| 12152 | |||
| 12153 |
1/2✓ Branch 0 taken 189 times.
✗ Branch 1 not taken.
|
189 | playerscripts[3] = new script_data(ScriptType::Player, 3); |
| 12154 | |||
| 12155 |
1/2✓ Branch 0 taken 189 times.
✗ Branch 1 not taken.
|
189 | if(playerscripts[4] != NULL) |
| 12156 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 189 times.
|
189 | delete playerscripts[4]; |
| 12157 | |||
| 12158 |
1/2✓ Branch 0 taken 189 times.
✗ Branch 1 not taken.
|
189 | playerscripts[4] = new script_data(ScriptType::Player, 4); |
| 12159 | } | ||
| 12160 |
3/4✓ Branch 0 taken 423 times.
✓ Branch 1 taken 189 times.
✓ Branch 2 taken 423 times.
✗ Branch 3 not taken.
|
612 | if(s_version > 8 && s_version < 10) |
| 12161 | { | ||
| 12162 | |||
| 12163 | ✗ | for(int32_t i = 0; i < NUMSCRIPTWEAPONS; i++) | |
| 12164 | { | ||
| 12165 | ✗ | ret = read_one_ffscript(f, Header, i, s_version, s_cversion, &ewpnscripts[i], zmeta_version); | |
| 12166 | |||
| 12167 | ✗ | if (ret) | |
| 12168 | { | ||
| 12169 | ✗ | return qe_invalid; | |
| 12170 | } | ||
| 12171 | ✗ | } | |
| 12172 | ✗ | for(int32_t i = 0; i < NUMSCRIPTSDMAP; i++) | |
| 12173 | { | ||
| 12174 | ✗ | ret = read_one_ffscript(f, Header, i, s_version, s_cversion, &dmapscripts[i], zmeta_version); | |
| 12175 | |||
| 12176 | ✗ | if (ret) | |
| 12177 | { | ||
| 12178 | ✗ | return qe_invalid; | |
| 12179 | } | ||
| 12180 | ✗ | } | |
| 12181 | |||
| 12182 | ✗ | } | |
| 12183 |
2/2✓ Branch 0 taken 189 times.
✓ Branch 1 taken 423 times.
|
612 | if(s_version >= 10) |
| 12184 | { | ||
| 12185 |
2/2✓ Branch 0 taken 108288 times.
✓ Branch 1 taken 423 times.
|
108711 | for(int32_t i = 0; i < NUMSCRIPTWEAPONS; i++) |
| 12186 | { | ||
| 12187 | 108288 | ret = read_one_ffscript(f, Header, i, s_version, s_cversion, &lwpnscripts[i], zmeta_version); | |
| 12188 | |||
| 12189 |
1/2✓ Branch 0 taken 108288 times.
✗ Branch 1 not taken.
|
108288 | if (ret) |
| 12190 | { | ||
| 12191 | ✗ | return qe_invalid; | |
| 12192 | } | ||
| 12193 | 108288 | } | |
| 12194 |
2/2✓ Branch 0 taken 108288 times.
✓ Branch 1 taken 423 times.
|
108711 | for(int32_t i = 0; i < NUMSCRIPTWEAPONS; i++) |
| 12195 | { | ||
| 12196 | 108288 | ret = read_one_ffscript(f, Header, i, s_version, s_cversion, &ewpnscripts[i], zmeta_version); | |
| 12197 | |||
| 12198 |
1/2✓ Branch 0 taken 108288 times.
✗ Branch 1 not taken.
|
108288 | if (ret) |
| 12199 | { | ||
| 12200 | ✗ | return qe_invalid; | |
| 12201 | } | ||
| 12202 | 108288 | } | |
| 12203 |
2/2✓ Branch 0 taken 108288 times.
✓ Branch 1 taken 423 times.
|
108711 | for(int32_t i = 0; i < NUMSCRIPTSDMAP; i++) |
| 12204 | { | ||
| 12205 | 108288 | ret = read_one_ffscript(f, Header, i, s_version, s_cversion, &dmapscripts[i], zmeta_version); | |
| 12206 | |||
| 12207 |
1/2✓ Branch 0 taken 108288 times.
✗ Branch 1 not taken.
|
108288 | if (ret) |
| 12208 | { | ||
| 12209 | ✗ | return qe_invalid; | |
| 12210 | } | ||
| 12211 | 108288 | } | |
| 12212 | |||
| 12213 | 423 | } | |
| 12214 |
2/2✓ Branch 0 taken 189 times.
✓ Branch 1 taken 423 times.
|
612 | if(s_version >=12) |
| 12215 | { | ||
| 12216 |
2/2✓ Branch 0 taken 108288 times.
✓ Branch 1 taken 423 times.
|
108711 | for(int32_t i = 0; i < NUMSCRIPTSITEMSPRITE; i++) |
| 12217 | { | ||
| 12218 | 108288 | ret = read_one_ffscript(f, Header, i, s_version, s_cversion, &itemspritescripts[i], zmeta_version); | |
| 12219 | |||
| 12220 |
1/2✓ Branch 0 taken 108288 times.
✗ Branch 1 not taken.
|
108288 | if (ret) |
| 12221 | { | ||
| 12222 | ✗ | return qe_invalid; | |
| 12223 | } | ||
| 12224 | 108288 | } | |
| 12225 | 423 | } | |
| 12226 |
2/2✓ Branch 0 taken 189 times.
✓ Branch 1 taken 423 times.
|
612 | if(s_version >=15) |
| 12227 | { | ||
| 12228 |
2/2✓ Branch 0 taken 216576 times.
✓ Branch 1 taken 423 times.
|
216999 | for(int32_t i = 0; i < NUMSCRIPTSCOMBODATA; i++) |
| 12229 | { | ||
| 12230 | 216576 | ret = read_one_ffscript(f, Header, i, s_version, s_cversion, &comboscripts[i], zmeta_version); | |
| 12231 | |||
| 12232 |
1/2✓ Branch 0 taken 216576 times.
✗ Branch 1 not taken.
|
216576 | if (ret) |
| 12233 | { | ||
| 12234 | ✗ | return qe_invalid; | |
| 12235 | } | ||
| 12236 | 216576 | } | |
| 12237 | 423 | } | |
| 12238 |
2/2✓ Branch 0 taken 189 times.
✓ Branch 1 taken 423 times.
|
612 | if(s_version >19) |
| 12239 | { | ||
| 12240 | 423 | word numgenscripts = NUMSCRIPTSGENERIC; | |
| 12241 |
1/2✓ Branch 0 taken 423 times.
✗ Branch 1 not taken.
|
423 | if(!p_igetw(&numgenscripts,f)) |
| 12242 | { | ||
| 12243 | ✗ | return qe_invalid; | |
| 12244 | } | ||
| 12245 |
2/2✓ Branch 0 taken 216576 times.
✓ Branch 1 taken 423 times.
|
216999 | for(int32_t i = 0; i < numgenscripts; i++) |
| 12246 | { | ||
| 12247 | 216576 | ret = read_one_ffscript(f, Header, i, s_version, s_cversion, &genericscripts[i], zmeta_version); | |
| 12248 | |||
| 12249 |
1/2✓ Branch 0 taken 216576 times.
✗ Branch 1 not taken.
|
216576 | if (ret) |
| 12250 | { | ||
| 12251 | ✗ | return qe_invalid; | |
| 12252 | } | ||
| 12253 | 216576 | } | |
| 12254 | 423 | } | |
| 12255 |
2/2✓ Branch 0 taken 207 times.
✓ Branch 1 taken 405 times.
|
612 | if(s_version >21) |
| 12256 | { | ||
| 12257 | 405 | word numsubscripts = NUMSCRIPTSSUBSCREEN; | |
| 12258 |
1/2✓ Branch 0 taken 405 times.
✗ Branch 1 not taken.
|
405 | if(!p_igetw(&numsubscripts,f)) |
| 12259 | { | ||
| 12260 | ✗ | return qe_invalid; | |
| 12261 | } | ||
| 12262 |
2/2✓ Branch 0 taken 103680 times.
✓ Branch 1 taken 405 times.
|
104085 | for(int32_t i = 0; i < numsubscripts; i++) |
| 12263 | { | ||
| 12264 | 103680 | ret = read_one_ffscript(f, Header, i, s_version, s_cversion, &subscreenscripts[i], zmeta_version); | |
| 12265 | |||
| 12266 |
1/2✓ Branch 0 taken 103680 times.
✗ Branch 1 not taken.
|
103680 | if (ret) |
| 12267 | { | ||
| 12268 | ✗ | return qe_invalid; | |
| 12269 | } | ||
| 12270 | 103680 | } | |
| 12271 | 405 | } | |
| 12272 | 612 | } | |
| 12273 | |||
| 12274 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 612 times.
|
612 | if(s_version > 2) |
| 12275 | { | ||
| 12276 | int32_t bufsize; | ||
| 12277 | 612 | p_igetl(&bufsize, f); | |
| 12278 |
2/4✓ Branch 0 taken 612 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 612 times.
|
612 | if (bufsize < 0 || bufsize > 1024*1024*10) |
| 12279 | { | ||
| 12280 | // God help anyone storing more than 10MB of code in the script buffer. | ||
| 12281 | ✗ | return qe_invalid; | |
| 12282 | } | ||
| 12283 | 612 | char * buf = new char[bufsize+1]; | |
| 12284 | 612 | pfread(buf, bufsize, f); | |
| 12285 | 612 | buf[bufsize]=0; | |
| 12286 | |||
| 12287 |
1/2✓ Branch 0 taken 612 times.
✗ Branch 1 not taken.
|
612 | zScript = string(buf); |
| 12288 | |||
| 12289 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 612 times.
|
612 | delete[] buf; |
| 12290 | word numffcbindings; | ||
| 12291 | 612 | p_igetw(&numffcbindings, f); | |
| 12292 | |||
| 12293 |
2/2✓ Branch 0 taken 9662 times.
✓ Branch 1 taken 612 times.
|
10274 | for(int32_t i=0; i<numffcbindings; i++) |
| 12294 | { | ||
| 12295 | word id; | ||
| 12296 | 9662 | p_igetw(&id, f); | |
| 12297 | 9662 | p_igetl(&bufsize, f); | |
| 12298 |
2/4✓ Branch 0 taken 9662 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 9662 times.
|
9662 | if (bufsize < 0 || bufsize > 1024) |
| 12299 | ✗ | return qe_invalid; | |
| 12300 | 9662 | buf = new char[bufsize+1]; | |
| 12301 | 9662 | pfread(buf, bufsize, f); | |
| 12302 | 9662 | buf[bufsize]=0; | |
| 12303 | |||
| 12304 | //fix for buggy older saved quests -DD | ||
| 12305 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 9662 times.
|
9662 | if(id < NUMSCRIPTFFC-1) |
| 12306 | 9662 | ffcmap[id].scriptname = buf; | |
| 12307 | |||
| 12308 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 9662 times.
|
9662 | delete[] buf; |
| 12309 | 9662 | } | |
| 12310 | |||
| 12311 | word numglobalbindings; | ||
| 12312 | 612 | p_igetw(&numglobalbindings, f); | |
| 12313 | |||
| 12314 |
2/2✓ Branch 0 taken 1758 times.
✓ Branch 1 taken 612 times.
|
2370 | for(int32_t i=0; i<numglobalbindings; i++) |
| 12315 | { | ||
| 12316 | word id; | ||
| 12317 | 1758 | p_igetw(&id, f); | |
| 12318 | 1758 | p_igetl(&bufsize, f); | |
| 12319 |
2/4✓ Branch 0 taken 1758 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1758 times.
✗ Branch 3 not taken.
|
1758 | if (bufsize < 0 || bufsize > 1024) |
| 12320 | ✗ | return qe_invalid; | |
| 12321 | 1758 | buf = new char[bufsize+1]; | |
| 12322 | 1758 | pfread(buf, bufsize, f); | |
| 12323 | 1758 | buf[bufsize]=0; | |
| 12324 | |||
| 12325 | // id in principle should be valid, since slot assignment cannot assign a global script to a bogus slot. | ||
| 12326 | // However, because of a corruption bug, some 2.50.x quests contain bogus entries in the global bindings table. | ||
| 12327 | // Ignore these. -DD | ||
| 12328 |
3/4✓ Branch 0 taken 1758 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 540 times.
✓ Branch 3 taken 1218 times.
|
1758 | if(id >= 0 && id < NUMSCRIPTGLOBAL) |
| 12329 | { | ||
| 12330 | //Disable old '~Continue's, they'd wreak havoc. Bit messy, apologies ~Joe | ||
| 12331 |
1/2✓ Branch 0 taken 1218 times.
✗ Branch 1 not taken.
|
1218 | if(strcmp(buf,"~Continue") == 0) |
| 12332 | { | ||
| 12333 | ✗ | globalmap[id].scriptname = ""; | |
| 12334 | |||
| 12335 | ✗ | if(globalscripts[GLOBAL_SCRIPT_ONSAVELOAD] != NULL) | |
| 12336 | ✗ | globalscripts[GLOBAL_SCRIPT_ONSAVELOAD]->disable(); | |
| 12337 | ✗ | } | |
| 12338 | else | ||
| 12339 | { | ||
| 12340 | 1218 | globalmap[id].scriptname = buf; | |
| 12341 | } | ||
| 12342 | 1218 | } | |
| 12343 | |||
| 12344 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1758 times.
|
1758 | delete[] buf; |
| 12345 | 1758 | } | |
| 12346 | |||
| 12347 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 612 times.
|
612 | if(s_version > 3) |
| 12348 | { | ||
| 12349 | word numitembindings; | ||
| 12350 | 612 | p_igetw(&numitembindings, f); | |
| 12351 | |||
| 12352 |
2/2✓ Branch 0 taken 1152 times.
✓ Branch 1 taken 612 times.
|
1764 | for(int32_t i=0; i<numitembindings; i++) |
| 12353 | { | ||
| 12354 | word id; | ||
| 12355 | 1152 | p_igetw(&id, f); | |
| 12356 | 1152 | p_igetl(&bufsize, f); | |
| 12357 |
2/4✓ Branch 0 taken 1152 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 1152 times.
|
1152 | if (bufsize < 0 || bufsize > 1024) |
| 12358 | ✗ | return qe_invalid; | |
| 12359 | 1152 | buf = new char[bufsize+1]; | |
| 12360 | 1152 | pfread(buf, bufsize, f); | |
| 12361 | 1152 | buf[bufsize]=0; | |
| 12362 | |||
| 12363 | //fix this too | ||
| 12364 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1152 times.
|
1152 | if(id <NUMSCRIPTITEM-1) |
| 12365 | 1152 | itemmap[id].scriptname = buf; | |
| 12366 | |||
| 12367 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1152 times.
|
1152 | delete[] buf; |
| 12368 | 1152 | } | |
| 12369 | 612 | } | |
| 12370 | //(v9+) | ||
| 12371 |
2/2✓ Branch 0 taken 189 times.
✓ Branch 1 taken 423 times.
|
612 | if(s_version > 8) |
| 12372 | { | ||
| 12373 | //npc scripts | ||
| 12374 | word numnpcbindings; | ||
| 12375 | 423 | p_igetw(&numnpcbindings, f); | |
| 12376 | |||
| 12377 |
2/2✓ Branch 0 taken 31 times.
✓ Branch 1 taken 423 times.
|
454 | for(int32_t i=0; i<numnpcbindings; i++) |
| 12378 | { | ||
| 12379 | word id; | ||
| 12380 | 31 | p_igetw(&id, f); | |
| 12381 | 31 | p_igetl(&bufsize, f); | |
| 12382 |
2/4✓ Branch 0 taken 31 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 31 times.
✗ Branch 3 not taken.
|
31 | if (bufsize < 0 || bufsize > 1024) |
| 12383 | ✗ | return qe_invalid; | |
| 12384 | 31 | buf = new char[bufsize+1]; | |
| 12385 | 31 | pfread(buf, bufsize, f); | |
| 12386 | 31 | buf[bufsize]=0; | |
| 12387 | |||
| 12388 | //fix this too | ||
| 12389 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 31 times.
|
31 | if(id <NUMSCRIPTGUYS-1) |
| 12390 | 31 | npcmap[id].scriptname = buf; | |
| 12391 | |||
| 12392 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 31 times.
|
31 | delete[] buf; |
| 12393 | 31 | } | |
| 12394 | //lweapon | ||
| 12395 | word numlwpnbindings; | ||
| 12396 | 423 | p_igetw(&numlwpnbindings, f); | |
| 12397 | |||
| 12398 |
2/2✓ Branch 0 taken 213 times.
✓ Branch 1 taken 423 times.
|
636 | for(int32_t i=0; i<numlwpnbindings; i++) |
| 12399 | { | ||
| 12400 | word id; | ||
| 12401 | 213 | p_igetw(&id, f); | |
| 12402 | 213 | p_igetl(&bufsize, f); | |
| 12403 |
2/4✓ Branch 0 taken 213 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 213 times.
✗ Branch 3 not taken.
|
213 | if (bufsize < 0 || bufsize > 1024) |
| 12404 | ✗ | return qe_invalid; | |
| 12405 | 213 | buf = new char[bufsize+1]; | |
| 12406 | 213 | pfread(buf, bufsize, f); | |
| 12407 | 213 | buf[bufsize]=0; | |
| 12408 | |||
| 12409 | //fix this too | ||
| 12410 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 213 times.
|
213 | if(id <NUMSCRIPTWEAPONS-1) |
| 12411 | 213 | lwpnmap[id].scriptname = buf; | |
| 12412 | |||
| 12413 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 213 times.
|
213 | delete[] buf; |
| 12414 | 213 | } | |
| 12415 | //eweapon | ||
| 12416 | word numewpnbindings; | ||
| 12417 | 423 | p_igetw(&numewpnbindings, f); | |
| 12418 | |||
| 12419 |
2/2✓ Branch 0 taken 280 times.
✓ Branch 1 taken 423 times.
|
703 | for(int32_t i=0; i<numewpnbindings; i++) |
| 12420 | { | ||
| 12421 | word id; | ||
| 12422 | 280 | p_igetw(&id, f); | |
| 12423 | 280 | p_igetl(&bufsize, f); | |
| 12424 |
2/4✓ Branch 0 taken 280 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 280 times.
✗ Branch 3 not taken.
|
280 | if (bufsize < 0 || bufsize > 1024) |
| 12425 | ✗ | return qe_invalid; | |
| 12426 | 280 | buf = new char[bufsize+1]; | |
| 12427 | 280 | pfread(buf, bufsize, f); | |
| 12428 | 280 | buf[bufsize]=0; | |
| 12429 | |||
| 12430 | //fix this too | ||
| 12431 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 280 times.
|
280 | if(id <NUMSCRIPTWEAPONS-1) |
| 12432 | 280 | ewpnmap[id].scriptname = buf; | |
| 12433 | |||
| 12434 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 280 times.
|
280 | delete[] buf; |
| 12435 | 280 | } | |
| 12436 | //hero | ||
| 12437 | word numherobindings; | ||
| 12438 | 423 | p_igetw(&numherobindings, f); | |
| 12439 | |||
| 12440 |
2/2✓ Branch 0 taken 21 times.
✓ Branch 1 taken 423 times.
|
444 | for(int32_t i=0; i<numherobindings; i++) |
| 12441 | { | ||
| 12442 | word id; | ||
| 12443 | 21 | p_igetw(&id, f); | |
| 12444 | 21 | p_igetl(&bufsize, f); | |
| 12445 |
2/4✓ Branch 0 taken 21 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 21 times.
|
21 | if (bufsize < 0 || bufsize > 1024) |
| 12446 | ✗ | return qe_invalid; | |
| 12447 | 21 | buf = new char[bufsize+1]; | |
| 12448 | 21 | pfread(buf, bufsize, f); | |
| 12449 | 21 | buf[bufsize]=0; | |
| 12450 | |||
| 12451 | //fix this too | ||
| 12452 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 21 times.
|
21 | if(id <NUMSCRIPTPLAYER-1) |
| 12453 | 21 | playermap[id].scriptname = buf; | |
| 12454 | |||
| 12455 |
1/2✓ Branch 0 taken 21 times.
✗ Branch 1 not taken.
|
21 | delete[] buf; |
| 12456 | 21 | } | |
| 12457 | //dmaps | ||
| 12458 | word numdmapbindings; | ||
| 12459 | 423 | p_igetw(&numdmapbindings, f); | |
| 12460 | |||
| 12461 |
2/2✓ Branch 0 taken 255 times.
✓ Branch 1 taken 423 times.
|
678 | for(int32_t i=0; i<numdmapbindings; i++) |
| 12462 | { | ||
| 12463 | word id; | ||
| 12464 | 255 | p_igetw(&id, f); | |
| 12465 | 255 | p_igetl(&bufsize, f); | |
| 12466 |
2/4✓ Branch 0 taken 255 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 255 times.
✗ Branch 3 not taken.
|
255 | if (bufsize < 0 || bufsize > 1024) |
| 12467 | ✗ | return qe_invalid; | |
| 12468 | 255 | buf = new char[bufsize+1]; | |
| 12469 | 255 | pfread(buf, bufsize, f); | |
| 12470 | 255 | buf[bufsize]=0; | |
| 12471 | |||
| 12472 | //fix this too | ||
| 12473 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 255 times.
|
255 | if(id <NUMSCRIPTSDMAP-1) |
| 12474 | 255 | dmapmap[id].scriptname = buf; | |
| 12475 | |||
| 12476 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 255 times.
|
255 | delete[] buf; |
| 12477 | 255 | } | |
| 12478 | //screen | ||
| 12479 | word numscreenbindings; | ||
| 12480 | 423 | p_igetw(&numscreenbindings, f); | |
| 12481 | |||
| 12482 |
2/2✓ Branch 0 taken 333 times.
✓ Branch 1 taken 423 times.
|
756 | for(int32_t i=0; i<numscreenbindings; i++) |
| 12483 | { | ||
| 12484 | word id; | ||
| 12485 | 333 | p_igetw(&id, f); | |
| 12486 | 333 | p_igetl(&bufsize, f); | |
| 12487 |
2/4✓ Branch 0 taken 333 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 333 times.
✗ Branch 3 not taken.
|
333 | if (bufsize < 0 || bufsize > 1024) |
| 12488 | ✗ | return qe_invalid; | |
| 12489 | 333 | buf = new char[bufsize+1]; | |
| 12490 | 333 | pfread(buf, bufsize, f); | |
| 12491 | 333 | buf[bufsize]=0; | |
| 12492 | |||
| 12493 | //fix this too | ||
| 12494 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 333 times.
|
333 | if(id <NUMSCRIPTSDMAP-1) |
| 12495 | 333 | screenmap[id].scriptname = buf; | |
| 12496 | |||
| 12497 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 333 times.
|
333 | delete[] buf; |
| 12498 | 333 | } | |
| 12499 | 423 | } | |
| 12500 |
2/2✓ Branch 0 taken 189 times.
✓ Branch 1 taken 423 times.
|
612 | if(s_version > 11) |
| 12501 | { | ||
| 12502 | word numspritebindings; | ||
| 12503 | 423 | p_igetw(&numspritebindings, f); | |
| 12504 | |||
| 12505 |
2/2✓ Branch 0 taken 44 times.
✓ Branch 1 taken 423 times.
|
467 | for(int32_t i=0; i<numspritebindings; i++) |
| 12506 | { | ||
| 12507 | word id; | ||
| 12508 | 44 | p_igetw(&id, f); | |
| 12509 | 44 | p_igetl(&bufsize, f); | |
| 12510 |
2/4✓ Branch 0 taken 44 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 44 times.
✗ Branch 3 not taken.
|
44 | if (bufsize < 0 || bufsize > 1024) |
| 12511 | ✗ | return qe_invalid; | |
| 12512 | 44 | buf = new char[bufsize+1]; | |
| 12513 | 44 | pfread(buf, bufsize, f); | |
| 12514 | 44 | buf[bufsize]=0; | |
| 12515 | |||
| 12516 | //fix this too | ||
| 12517 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 44 times.
|
44 | if(id <NUMSCRIPTSDMAP-1) |
| 12518 | 44 | itemspritemap[id].scriptname = buf; | |
| 12519 | |||
| 12520 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 44 times.
|
44 | delete[] buf; |
| 12521 | 44 | } | |
| 12522 | 423 | } | |
| 12523 |
2/2✓ Branch 0 taken 189 times.
✓ Branch 1 taken 423 times.
|
612 | if(s_version >= 15) |
| 12524 | { | ||
| 12525 | word numcombobindings; | ||
| 12526 | 423 | p_igetw(&numcombobindings, f); | |
| 12527 | |||
| 12528 |
2/2✓ Branch 0 taken 143 times.
✓ Branch 1 taken 423 times.
|
566 | for(int32_t i=0; i<numcombobindings; i++) |
| 12529 | { | ||
| 12530 | word id; | ||
| 12531 | 143 | p_igetw(&id, f); | |
| 12532 | 143 | p_igetl(&bufsize, f); | |
| 12533 |
2/4✓ Branch 0 taken 143 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 143 times.
|
143 | if (bufsize < 0 || bufsize > 1024) |
| 12534 | ✗ | return qe_invalid; | |
| 12535 | 143 | buf = new char[bufsize+1]; | |
| 12536 | 143 | pfread(buf, bufsize, f); | |
| 12537 | 143 | buf[bufsize]=0; | |
| 12538 | |||
| 12539 | //fix this too | ||
| 12540 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 143 times.
|
143 | if(id <NUMSCRIPTSCOMBODATA-1) |
| 12541 | 143 | comboscriptmap[id].scriptname = buf; | |
| 12542 | |||
| 12543 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 143 times.
|
143 | delete[] buf; |
| 12544 | 143 | } | |
| 12545 | 423 | } | |
| 12546 |
2/2✓ Branch 0 taken 189 times.
✓ Branch 1 taken 423 times.
|
612 | if(s_version > 19) |
| 12547 | { | ||
| 12548 | word numgenericbindings; | ||
| 12549 | 423 | p_igetw(&numgenericbindings, f); | |
| 12550 | |||
| 12551 |
2/2✓ Branch 0 taken 103 times.
✓ Branch 1 taken 423 times.
|
526 | for(int32_t i=0; i<numgenericbindings; i++) |
| 12552 | { | ||
| 12553 | word id; | ||
| 12554 | 103 | p_igetw(&id, f); | |
| 12555 | 103 | p_igetl(&bufsize, f); | |
| 12556 |
2/4✓ Branch 0 taken 103 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 103 times.
|
103 | if (bufsize < 0 || bufsize > 1024) |
| 12557 | ✗ | return qe_invalid; | |
| 12558 | 103 | buf = new char[bufsize+1]; | |
| 12559 | 103 | pfread(buf, bufsize, f); | |
| 12560 | 103 | buf[bufsize]=0; | |
| 12561 | |||
| 12562 | //fix this too | ||
| 12563 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 103 times.
|
103 | if(id <NUMSCRIPTSGENERIC-1) |
| 12564 | 103 | genericmap[id].scriptname = buf; | |
| 12565 | |||
| 12566 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 103 times.
|
103 | delete[] buf; |
| 12567 | 103 | } | |
| 12568 | 423 | } | |
| 12569 |
2/2✓ Branch 0 taken 207 times.
✓ Branch 1 taken 405 times.
|
612 | if(s_version > 21) |
| 12570 | { | ||
| 12571 | word numsubscreenbindings; | ||
| 12572 | 405 | p_igetw(&numsubscreenbindings, f); | |
| 12573 | |||
| 12574 |
2/2✓ Branch 0 taken 7 times.
✓ Branch 1 taken 405 times.
|
412 | for(int32_t i=0; i<numsubscreenbindings; i++) |
| 12575 | { | ||
| 12576 | word id; | ||
| 12577 | 7 | p_igetw(&id, f); | |
| 12578 | 7 | p_igetl(&bufsize, f); | |
| 12579 |
2/4✓ Branch 0 taken 7 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 7 times.
|
7 | if (bufsize < 0 || bufsize > 1024) |
| 12580 | ✗ | return qe_invalid; | |
| 12581 | 7 | buf = new char[bufsize+1]; | |
| 12582 | 7 | pfread(buf, bufsize, f); | |
| 12583 | 7 | buf[bufsize]=0; | |
| 12584 | |||
| 12585 | //fix this too | ||
| 12586 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 7 times.
|
7 | if(id <NUMSCRIPTSSUBSCREEN-1) |
| 12587 | 7 | subscreenmap[id].scriptname = buf; | |
| 12588 | |||
| 12589 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 7 times.
|
7 | delete[] buf; |
| 12590 | 7 | } | |
| 12591 | 405 | } | |
| 12592 | 612 | } | |
| 12593 | |||
| 12594 | // Set ZScriptVersion to the value encoded in the script's meta.ffscript_v. | ||
| 12595 | // This is only updated when the scripts have been recompiled. | ||
| 12596 | // They should all match each other. | ||
| 12597 | 612 | std::optional<word> zscript_version; | |
| 12598 |
2/2✓ Branch 0 taken 189 times.
✓ Branch 1 taken 423 times.
|
612 | if (s_version >= 16) |
| 12599 | { | ||
| 12600 |
1/2✓ Branch 0 taken 423 times.
✗ Branch 1 not taken.
|
423 | for (auto script : read_scripts) |
| 12601 | { | ||
| 12602 | ✗ | if (script->meta.ffscript_v == 0 || script->meta.ffscript_v > s_version) | |
| 12603 | ✗ | break; | |
| 12604 | |||
| 12605 | ✗ | if (!zscript_version.has_value()) | |
| 12606 | { | ||
| 12607 | ✗ | zscript_version = script->meta.ffscript_v; | |
| 12608 | ✗ | continue; | |
| 12609 | } | ||
| 12610 | |||
| 12611 | ✗ | if (zscript_version.value() != script->meta.ffscript_v) | |
| 12612 | { | ||
| 12613 | ✗ | zscript_version.reset(); | |
| 12614 | ✗ | break; | |
| 12615 | } | ||
| 12616 | } | ||
| 12617 | |||
| 12618 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 423 times.
|
423 | if (!zscript_version.has_value()) |
| 12619 | 423 | al_trace("WARNING: Setting zscript version to section version as fallback.\n"); | |
| 12620 | 423 | } | |
| 12621 | 612 | setZScriptVersion(zscript_version.value_or(s_version)); | |
| 12622 | 612 | read_scripts.clear(); | |
| 12623 | |||
| 12624 | 612 | return 0; | |
| 12625 | 612 | } | |
| 12626 | |||
| 12627 | 694 | void reset_scripts() | |
| 12628 | { | ||
| 12629 | #ifdef IS_PLAYER | ||
| 12630 | // We can't modify the script data while jit threads are possibly compiling them. | ||
| 12631 | void jit_shutdown(); | ||
| 12632 | 685 | jit_shutdown(); | |
| 12633 | #endif | ||
| 12634 | |||
| 12635 |
2/2✓ Branch 0 taken 355328 times.
✓ Branch 1 taken 694 times.
|
356022 | for(int32_t i=0; i<NUMSCRIPTSGENERIC; i++) |
| 12636 | { | ||
| 12637 |
1/2✓ Branch 0 taken 355328 times.
✗ Branch 1 not taken.
|
355328 | if (genericscripts[i]!=NULL) genericscripts[i]->disable(); |
| 12638 | ✗ | else genericscripts[i] = new script_data({ScriptType::Generic, i}); | |
| 12639 | 355328 | } | |
| 12640 | |||
| 12641 |
2/2✓ Branch 0 taken 355328 times.
✓ Branch 1 taken 694 times.
|
356022 | for(int32_t i=0; i<NUMSCRIPTFFC; i++) |
| 12642 | { | ||
| 12643 |
1/2✓ Branch 0 taken 355328 times.
✗ Branch 1 not taken.
|
355328 | if (ffscripts[i]) |
| 12644 | 355328 | ffscripts[i]->disable(); | |
| 12645 | else | ||
| 12646 | ✗ | ffscripts[i] = new script_data(ScriptType::FFC, i); | |
| 12647 | 355328 | } | |
| 12648 | |||
| 12649 |
2/2✓ Branch 0 taken 177664 times.
✓ Branch 1 taken 694 times.
|
178358 | for(int32_t i=0; i<NUMSCRIPTITEM; i++) |
| 12650 | { | ||
| 12651 |
1/2✓ Branch 0 taken 177664 times.
✗ Branch 1 not taken.
|
177664 | if (itemscripts[i]) |
| 12652 | 177664 | itemscripts[i]->disable(); | |
| 12653 | else | ||
| 12654 | ✗ | itemscripts[i] = new script_data(ScriptType::Item, i); | |
| 12655 | 177664 | } | |
| 12656 | |||
| 12657 |
2/2✓ Branch 0 taken 177664 times.
✓ Branch 1 taken 694 times.
|
178358 | for(int32_t i=0; i<NUMSCRIPTGUYS; i++) |
| 12658 | { | ||
| 12659 |
1/2✓ Branch 0 taken 177664 times.
✗ Branch 1 not taken.
|
177664 | if (guyscripts[i]) |
| 12660 | 177664 | guyscripts[i]->disable(); | |
| 12661 | else | ||
| 12662 | ✗ | guyscripts[i] = new script_data(ScriptType::NPC, i); | |
| 12663 | 177664 | } | |
| 12664 | |||
| 12665 |
2/2✓ Branch 0 taken 177664 times.
✓ Branch 1 taken 694 times.
|
178358 | for(int32_t i=0; i<NUMSCRIPTSCREEN; i++) |
| 12666 | { | ||
| 12667 |
1/2✓ Branch 0 taken 177664 times.
✗ Branch 1 not taken.
|
177664 | if (screenscripts[i]) |
| 12668 | 177664 | screenscripts[i]->disable(); | |
| 12669 | else | ||
| 12670 | ✗ | screenscripts[i] = new script_data(ScriptType::Screen, i); | |
| 12671 | 177664 | } | |
| 12672 | |||
| 12673 |
2/2✓ Branch 0 taken 5552 times.
✓ Branch 1 taken 694 times.
|
6246 | for(int32_t i=0; i<NUMSCRIPTGLOBAL; i++) |
| 12674 | { | ||
| 12675 |
1/2✓ Branch 0 taken 5552 times.
✗ Branch 1 not taken.
|
5552 | if (globalscripts[i]) |
| 12676 | 5552 | globalscripts[i]->disable(); | |
| 12677 | else | ||
| 12678 | ✗ | globalscripts[i] = new script_data(ScriptType::Global, i); | |
| 12679 | 5552 | } | |
| 12680 | |||
| 12681 |
2/2✓ Branch 0 taken 3470 times.
✓ Branch 1 taken 694 times.
|
4164 | for(int32_t i=0; i<NUMSCRIPTPLAYER; i++) |
| 12682 | { | ||
| 12683 |
1/2✓ Branch 0 taken 3470 times.
✗ Branch 1 not taken.
|
3470 | if (playerscripts[i]) |
| 12684 | 3470 | playerscripts[i]->disable(); | |
| 12685 | else | ||
| 12686 | ✗ | playerscripts[i] = new script_data(ScriptType::Player, i); | |
| 12687 | 3470 | } | |
| 12688 | |||
| 12689 |
2/2✓ Branch 0 taken 177664 times.
✓ Branch 1 taken 694 times.
|
178358 | for(int32_t i=0; i<NUMSCRIPTWEAPONS; i++) |
| 12690 | { | ||
| 12691 |
1/2✓ Branch 0 taken 177664 times.
✗ Branch 1 not taken.
|
177664 | if (lwpnscripts[i]) |
| 12692 | 177664 | lwpnscripts[i]->disable(); | |
| 12693 | else | ||
| 12694 | ✗ | lwpnscripts[i] = new script_data(ScriptType::Lwpn, i); | |
| 12695 | 177664 | } | |
| 12696 |
2/2✓ Branch 0 taken 177664 times.
✓ Branch 1 taken 694 times.
|
178358 | for(int32_t i=0; i<NUMSCRIPTWEAPONS; i++) |
| 12697 | { | ||
| 12698 |
1/2✓ Branch 0 taken 177664 times.
✗ Branch 1 not taken.
|
177664 | if (ewpnscripts[i]) |
| 12699 | 177664 | ewpnscripts[i]->disable(); | |
| 12700 | else | ||
| 12701 | ✗ | ewpnscripts[i] = new script_data(ScriptType::Ewpn, i); | |
| 12702 | 177664 | } | |
| 12703 | |||
| 12704 |
2/2✓ Branch 0 taken 177664 times.
✓ Branch 1 taken 694 times.
|
178358 | for(int32_t i=0; i<NUMSCRIPTSDMAP; i++) |
| 12705 | { | ||
| 12706 |
1/2✓ Branch 0 taken 177664 times.
✗ Branch 1 not taken.
|
177664 | if (dmapscripts[i]) |
| 12707 | 177664 | dmapscripts[i]->disable(); | |
| 12708 | else | ||
| 12709 | ✗ | dmapscripts[i] = new script_data(ScriptType::DMap, i); | |
| 12710 | 177664 | } | |
| 12711 |
2/2✓ Branch 0 taken 177664 times.
✓ Branch 1 taken 694 times.
|
178358 | for(int32_t i=0; i<NUMSCRIPTSITEMSPRITE; i++) |
| 12712 | { | ||
| 12713 |
1/2✓ Branch 0 taken 177664 times.
✗ Branch 1 not taken.
|
177664 | if (itemspritescripts[i]) |
| 12714 | 177664 | itemspritescripts[i]->disable(); | |
| 12715 | else | ||
| 12716 | ✗ | itemspritescripts[i] = new script_data(ScriptType::ItemSprite, i); | |
| 12717 | 177664 | } | |
| 12718 |
2/2✓ Branch 0 taken 355328 times.
✓ Branch 1 taken 694 times.
|
356022 | for(int32_t i=0; i<NUMSCRIPTSCOMBODATA; i++) |
| 12719 | { | ||
| 12720 |
1/2✓ Branch 0 taken 355328 times.
✗ Branch 1 not taken.
|
355328 | if (comboscripts[i]) |
| 12721 | 355328 | comboscripts[i]->disable(); | |
| 12722 | else | ||
| 12723 | ✗ | comboscripts[i] = new script_data(ScriptType::Combo, i); | |
| 12724 | 355328 | } | |
| 12725 |
2/2✓ Branch 0 taken 177664 times.
✓ Branch 1 taken 694 times.
|
178358 | for(int32_t i=0; i<NUMSCRIPTSSUBSCREEN; i++) |
| 12726 | { | ||
| 12727 |
1/2✓ Branch 0 taken 177664 times.
✗ Branch 1 not taken.
|
177664 | if (subscreenscripts[i]) |
| 12728 | 177664 | subscreenscripts[i]->disable(); | |
| 12729 | else | ||
| 12730 | ✗ | subscreenscripts[i] = new script_data(ScriptType::EngineSubscreen, i); | |
| 12731 | 177664 | } | |
| 12732 | 694 | } | |
| 12733 | |||
| 12734 | 1916838 | int32_t read_one_ffscript(PACKFILE *f, zquestheader *, int32_t script_index, word s_version, word , script_data **script, word zmeta_version) | |
| 12735 | { | ||
| 12736 | // TODO: refactor to just take a script_data* | ||
| 12737 | ASSERT(*script); | ||
| 12738 | |||
| 12739 | //Please also update loadquest() when modifying this method -DD | ||
| 12740 | 1916838 | char b33[34] = {0}; | |
| 12741 | 1916838 | b33[33] = 0; | |
| 12742 | 1916838 | int32_t num_commands=1000; | |
| 12743 | |||
| 12744 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1916838 times.
|
1916838 | if(s_version>=2) |
| 12745 | { | ||
| 12746 |
1/2✓ Branch 0 taken 1916838 times.
✗ Branch 1 not taken.
|
1916838 | if(!p_igetl(&num_commands,f)) |
| 12747 | { | ||
| 12748 | ✗ | return qe_invalid; | |
| 12749 | } | ||
| 12750 | 1916838 | } | |
| 12751 | |||
| 12752 | #ifdef ZC_FUZZ | ||
| 12753 | const int32_t command_limit = 300000; | ||
| 12754 | #else | ||
| 12755 | 1916838 | const int32_t command_limit = 10000000; | |
| 12756 | #endif | ||
| 12757 |
2/4✓ Branch 0 taken 1916838 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 1916838 times.
|
1916838 | if (num_commands < 0 || num_commands > command_limit) |
| 12758 | { | ||
| 12759 | ✗ | return qe_invalid; | |
| 12760 | } | ||
| 12761 | |||
| 12762 | 1916838 | std::vector<ffscript> zasm; | |
| 12763 |
1/2✓ Branch 0 taken 1916838 times.
✗ Branch 1 not taken.
|
1916838 | zasm.reserve(num_commands); |
| 12764 | |||
| 12765 |
2/2✓ Branch 0 taken 1625211 times.
✓ Branch 1 taken 291627 times.
|
1916838 | if(s_version >= 16) |
| 12766 | { | ||
| 12767 |
1/2✓ Branch 0 taken 1625211 times.
✗ Branch 1 not taken.
|
1625211 | zasm_meta temp_meta; |
| 12768 | |||
| 12769 |
2/4✓ Branch 0 taken 1625211 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1625211 times.
✗ Branch 3 not taken.
|
1625211 | if(!p_igetw(&(temp_meta.zasm_v),f)) |
| 12770 | { | ||
| 12771 | ✗ | return qe_invalid; | |
| 12772 | } | ||
| 12773 | |||
| 12774 |
2/4✓ Branch 0 taken 1625211 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1625211 times.
✗ Branch 3 not taken.
|
1625211 | if(!p_igetw(&(temp_meta.meta_v),f)) |
| 12775 | { | ||
| 12776 | ✗ | return qe_invalid; | |
| 12777 | } | ||
| 12778 | |||
| 12779 |
2/4✓ Branch 0 taken 1625211 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1625211 times.
✗ Branch 3 not taken.
|
1625211 | if(!p_igetw(&(temp_meta.ffscript_v),f)) |
| 12780 | { | ||
| 12781 | ✗ | return qe_invalid; | |
| 12782 | } | ||
| 12783 | |||
| 12784 |
2/4✓ Branch 0 taken 1625211 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1625211 times.
✗ Branch 3 not taken.
|
1625211 | if(!p_getc(&(temp_meta.script_type),f)) |
| 12785 | { | ||
| 12786 | ✗ | return qe_invalid; | |
| 12787 | } | ||
| 12788 | |||
| 12789 |
2/2✓ Branch 0 taken 13001688 times.
✓ Branch 1 taken 1625211 times.
|
14626899 | for(int32_t q = 0; q < 8; ++q) |
| 12790 | { | ||
| 12791 |
2/2✓ Branch 0 taken 143880 times.
✓ Branch 1 taken 12857808 times.
|
13001688 | if(zmeta_version < 3) |
| 12792 | { | ||
| 12793 |
2/2✓ Branch 0 taken 143880 times.
✓ Branch 1 taken 4748040 times.
|
4891920 | for(int32_t c = 0; c < 33; ++c) |
| 12794 | { | ||
| 12795 |
2/4✓ Branch 0 taken 4748040 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4748040 times.
✗ Branch 3 not taken.
|
4748040 | if(!p_getc(&(b33[c]),f)) |
| 12796 | { | ||
| 12797 | ✗ | return qe_invalid; | |
| 12798 | } | ||
| 12799 | 4748040 | } | |
| 12800 |
1/2✓ Branch 0 taken 143880 times.
✗ Branch 1 not taken.
|
143880 | temp_meta.run_idens[q].assign(b33); |
| 12801 | 143880 | } | |
| 12802 | else | ||
| 12803 | { | ||
| 12804 |
2/4✓ Branch 0 taken 12857808 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 12857808 times.
✗ Branch 3 not taken.
|
12857808 | if(!p_getcstr(&temp_meta.run_idens[q],f)) |
| 12805 | { | ||
| 12806 | ✗ | return qe_invalid; | |
| 12807 | } | ||
| 12808 | } | ||
| 12809 | 13001688 | } | |
| 12810 | |||
| 12811 |
2/2✓ Branch 0 taken 1625211 times.
✓ Branch 1 taken 13001688 times.
|
14626899 | for(int32_t q = 0; q < 8; ++q) |
| 12812 | { | ||
| 12813 |
2/4✓ Branch 0 taken 13001688 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 13001688 times.
✗ Branch 3 not taken.
|
13001688 | if(!p_getc(&(temp_meta.run_types[q]),f)) |
| 12814 | { | ||
| 12815 | ✗ | return qe_invalid; | |
| 12816 | } | ||
| 12817 | 13001688 | } | |
| 12818 | |||
| 12819 |
2/4✓ Branch 0 taken 1625211 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1625211 times.
✗ Branch 3 not taken.
|
1625211 | if(!p_getc(&(temp_meta.flags),f)) |
| 12820 | { | ||
| 12821 | ✗ | return qe_invalid; | |
| 12822 | } | ||
| 12823 | |||
| 12824 |
2/4✓ Branch 0 taken 1625211 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1625211 times.
✗ Branch 3 not taken.
|
1625211 | if(!p_igetw(&(temp_meta.compiler_v1),f)) |
| 12825 | { | ||
| 12826 | ✗ | return qe_invalid; | |
| 12827 | } | ||
| 12828 | |||
| 12829 |
2/4✓ Branch 0 taken 1625211 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1625211 times.
✗ Branch 3 not taken.
|
1625211 | if(!p_igetw(&(temp_meta.compiler_v2),f)) |
| 12830 | { | ||
| 12831 | ✗ | return qe_invalid; | |
| 12832 | } | ||
| 12833 | |||
| 12834 |
2/4✓ Branch 0 taken 1625211 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1625211 times.
✗ Branch 3 not taken.
|
1625211 | if(!p_igetw(&(temp_meta.compiler_v3),f)) |
| 12835 | { | ||
| 12836 | ✗ | return qe_invalid; | |
| 12837 | } | ||
| 12838 | |||
| 12839 |
2/4✓ Branch 0 taken 1625211 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1625211 times.
✗ Branch 3 not taken.
|
1625211 | if(!p_igetw(&(temp_meta.compiler_v4),f)) |
| 12840 | { | ||
| 12841 | ✗ | return qe_invalid; | |
| 12842 | } | ||
| 12843 | |||
| 12844 |
2/2✓ Branch 0 taken 17985 times.
✓ Branch 1 taken 1607226 times.
|
1625211 | if(zmeta_version == 2) |
| 12845 | { | ||
| 12846 |
2/2✓ Branch 0 taken 17985 times.
✓ Branch 1 taken 593505 times.
|
611490 | for(int32_t c = 0; c < 33; ++c) |
| 12847 | { | ||
| 12848 |
2/4✓ Branch 0 taken 593505 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 593505 times.
✗ Branch 3 not taken.
|
593505 | if(!p_getc(&b33[c],f)) |
| 12849 | { | ||
| 12850 | ✗ | return qe_invalid; | |
| 12851 | } | ||
| 12852 | 593505 | } | |
| 12853 |
1/2✓ Branch 0 taken 17985 times.
✗ Branch 1 not taken.
|
17985 | temp_meta.script_name.assign(b33); |
| 12854 | |||
| 12855 |
2/2✓ Branch 0 taken 17985 times.
✓ Branch 1 taken 593505 times.
|
611490 | for(int32_t c = 0; c < 33; ++c) |
| 12856 | { | ||
| 12857 |
2/4✓ Branch 0 taken 593505 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 593505 times.
✗ Branch 3 not taken.
|
593505 | if(!p_getc(&b33[c],f)) |
| 12858 | { | ||
| 12859 | ✗ | return qe_invalid; | |
| 12860 | } | ||
| 12861 | 593505 | } | |
| 12862 |
1/2✓ Branch 0 taken 17985 times.
✗ Branch 1 not taken.
|
17985 | temp_meta.author.assign(b33); |
| 12863 | 17985 | } | |
| 12864 |
1/2✓ Branch 0 taken 1607226 times.
✗ Branch 1 not taken.
|
1607226 | else if(zmeta_version > 2) |
| 12865 | { | ||
| 12866 |
2/4✓ Branch 0 taken 1607226 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1607226 times.
✗ Branch 3 not taken.
|
1607226 | if(!p_getcstr(&temp_meta.script_name,f)) |
| 12867 | ✗ | return qe_invalid; | |
| 12868 |
2/4✓ Branch 0 taken 1607226 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1607226 times.
✗ Branch 3 not taken.
|
1607226 | if(!p_getcstr(&temp_meta.author,f)) |
| 12869 | ✗ | return qe_invalid; | |
| 12870 | 1607226 | auto num_meta_attrib = (zmeta_version < 5 ? 4 : 10); | |
| 12871 |
2/2✓ Branch 0 taken 16072260 times.
✓ Branch 1 taken 1607226 times.
|
17679486 | for(auto q = 0; q < num_meta_attrib; ++q) |
| 12872 | { | ||
| 12873 |
2/4✓ Branch 0 taken 16072260 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 16072260 times.
✗ Branch 3 not taken.
|
16072260 | if(!p_getcstr(&temp_meta.attributes[q],f)) |
| 12874 | ✗ | return qe_invalid; | |
| 12875 |
2/4✓ Branch 0 taken 16072260 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 16072260 times.
✗ Branch 3 not taken.
|
16072260 | if(!p_getwstr(&temp_meta.attributes_help[q],f)) |
| 12876 | ✗ | return qe_invalid; | |
| 12877 | 16072260 | } | |
| 12878 |
2/2✓ Branch 0 taken 12857808 times.
✓ Branch 1 taken 1607226 times.
|
14465034 | for(auto q = 0; q < 8; ++q) |
| 12879 | { | ||
| 12880 |
2/4✓ Branch 0 taken 12857808 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 12857808 times.
✗ Branch 3 not taken.
|
12857808 | if(!p_getcstr(&temp_meta.attribytes[q],f)) |
| 12881 | ✗ | return qe_invalid; | |
| 12882 |
2/4✓ Branch 0 taken 12857808 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 12857808 times.
✗ Branch 3 not taken.
|
12857808 | if(!p_getwstr(&temp_meta.attribytes_help[q],f)) |
| 12883 | ✗ | return qe_invalid; | |
| 12884 | 12857808 | } | |
| 12885 |
2/2✓ Branch 0 taken 12857808 times.
✓ Branch 1 taken 1607226 times.
|
14465034 | for(auto q = 0; q < 8; ++q) |
| 12886 | { | ||
| 12887 |
2/4✓ Branch 0 taken 12857808 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 12857808 times.
✗ Branch 3 not taken.
|
12857808 | if(!p_getcstr(&temp_meta.attrishorts[q],f)) |
| 12888 | ✗ | return qe_invalid; | |
| 12889 |
2/4✓ Branch 0 taken 12857808 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 12857808 times.
✗ Branch 3 not taken.
|
12857808 | if(!p_getwstr(&temp_meta.attrishorts_help[q],f)) |
| 12890 | ✗ | return qe_invalid; | |
| 12891 | 12857808 | } | |
| 12892 |
2/2✓ Branch 0 taken 25715616 times.
✓ Branch 1 taken 1607226 times.
|
27322842 | for(auto q = 0; q < 16; ++q) |
| 12893 | { | ||
| 12894 |
2/4✓ Branch 0 taken 25715616 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 25715616 times.
✗ Branch 3 not taken.
|
25715616 | if(!p_getcstr(&temp_meta.usrflags[q],f)) |
| 12895 | ✗ | return qe_invalid; | |
| 12896 |
2/4✓ Branch 0 taken 25715616 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 25715616 times.
✗ Branch 3 not taken.
|
25715616 | if(!p_getwstr(&temp_meta.usrflags_help[q],f)) |
| 12897 | ✗ | return qe_invalid; | |
| 12898 | 25715616 | } | |
| 12899 | 1607226 | } | |
| 12900 |
2/2✓ Branch 0 taken 1607226 times.
✓ Branch 1 taken 17985 times.
|
1625211 | if(zmeta_version > 3) |
| 12901 | { | ||
| 12902 |
2/2✓ Branch 0 taken 12857808 times.
✓ Branch 1 taken 1607226 times.
|
14465034 | for(auto q = 0; q < 8; ++q) |
| 12903 | { | ||
| 12904 |
2/4✓ Branch 0 taken 12857808 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 12857808 times.
✗ Branch 3 not taken.
|
12857808 | if(!p_getcstr(&temp_meta.initd[q],f)) |
| 12905 | ✗ | return qe_invalid; | |
| 12906 |
2/4✓ Branch 0 taken 12857808 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 12857808 times.
✗ Branch 3 not taken.
|
12857808 | if(!p_getwstr(&temp_meta.initd_help[q],f)) |
| 12907 | ✗ | return qe_invalid; | |
| 12908 | 12857808 | } | |
| 12909 |
2/2✓ Branch 0 taken 12857808 times.
✓ Branch 1 taken 1607226 times.
|
14465034 | for(auto q = 0; q < 8; ++q) |
| 12910 | { | ||
| 12911 |
2/4✓ Branch 0 taken 12857808 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 12857808 times.
✗ Branch 3 not taken.
|
12857808 | if(!p_getc(&temp_meta.initd_type[q],f)) |
| 12912 | ✗ | return qe_invalid; | |
| 12913 | 12857808 | } | |
| 12914 | 1607226 | } | |
| 12915 | else | ||
| 12916 | { | ||
| 12917 |
2/2✓ Branch 0 taken 143880 times.
✓ Branch 1 taken 17985 times.
|
161865 | for(auto q = 0; q < 8; ++q) |
| 12918 | { | ||
| 12919 |
1/2✓ Branch 0 taken 143880 times.
✗ Branch 1 not taken.
|
143880 | temp_meta.initd[q] = temp_meta.run_idens[q]; |
| 12920 | 143880 | } | |
| 12921 | } | ||
| 12922 | |||
| 12923 |
1/2✓ Branch 0 taken 1625211 times.
✗ Branch 1 not taken.
|
1625211 | (*script)->meta = temp_meta; |
| 12924 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1625211 times.
|
1625211 | } |
| 12925 | |||
| 12926 |
2/2✓ Branch 0 taken 94474542 times.
✓ Branch 1 taken 140726 times.
|
94615268 | for(int32_t j=0; j<num_commands; j++) |
| 12927 | { | ||
| 12928 |
1/2✓ Branch 0 taken 94474542 times.
✗ Branch 1 not taken.
|
94474542 | auto& sc = zasm.emplace_back(); |
| 12929 |
2/4✓ Branch 0 taken 94474542 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 94474542 times.
✗ Branch 3 not taken.
|
94474542 | if(!p_igetw(&sc.command,f)) |
| 12930 | { | ||
| 12931 | ✗ | return qe_invalid; | |
| 12932 | } | ||
| 12933 | |||
| 12934 |
2/2✓ Branch 0 taken 92698430 times.
✓ Branch 1 taken 1776112 times.
|
94474542 | if(sc.command == 0xFFFF) |
| 12935 | { | ||
| 12936 | 1776112 | break; | |
| 12937 | } | ||
| 12938 | |||
| 12939 |
2/4✓ Branch 0 taken 92698430 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 92698430 times.
✗ Branch 3 not taken.
|
92698430 | if(!p_igetl(&sc.arg1,f)) |
| 12940 | { | ||
| 12941 | ✗ | return qe_invalid; | |
| 12942 | } | ||
| 12943 | |||
| 12944 |
2/4✓ Branch 0 taken 92698430 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 92698430 times.
✗ Branch 3 not taken.
|
92698430 | if(!p_igetl(&sc.arg2,f)) |
| 12945 | { | ||
| 12946 | ✗ | return qe_invalid; | |
| 12947 | } | ||
| 12948 | |||
| 12949 |
2/2✓ Branch 0 taken 2367863 times.
✓ Branch 1 taken 90330567 times.
|
92698430 | if(s_version >= 24) |
| 12950 |
2/4✓ Branch 0 taken 2367863 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2367863 times.
✗ Branch 3 not taken.
|
2367863 | if(!p_igetl(&sc.arg3,f)) |
| 12951 | ✗ | return qe_invalid; | |
| 12952 | |||
| 12953 |
2/2✓ Branch 0 taken 8623596 times.
✓ Branch 1 taken 84074834 times.
|
92698430 | if(s_version >= 21) |
| 12954 | { | ||
| 12955 | 8623596 | uint32_t sz = 0; | |
| 12956 |
2/4✓ Branch 0 taken 8623596 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 8623596 times.
✗ Branch 3 not taken.
|
8623596 | if(!p_igetl(&sz,f)) |
| 12957 | { | ||
| 12958 | ✗ | return qe_invalid; | |
| 12959 | } | ||
| 12960 |
2/2✓ Branch 0 taken 34128 times.
✓ Branch 1 taken 8589468 times.
|
8623596 | if(sz) //string found |
| 12961 | { | ||
| 12962 |
1/2✓ Branch 0 taken 34128 times.
✗ Branch 1 not taken.
|
34128 | sc.strptr = new std::string(); |
| 12963 | char dummy; | ||
| 12964 |
2/2✓ Branch 0 taken 1312895 times.
✓ Branch 1 taken 34128 times.
|
1347023 | for(size_t q = 0; q < sz; ++q) |
| 12965 | { | ||
| 12966 |
2/4✓ Branch 0 taken 1312895 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1312895 times.
✗ Branch 3 not taken.
|
1312895 | if(!p_getc(&dummy,f)) |
| 12967 | { | ||
| 12968 | ✗ | return qe_invalid; | |
| 12969 | } | ||
| 12970 |
1/2✓ Branch 0 taken 1312895 times.
✗ Branch 1 not taken.
|
1312895 | sc.strptr->push_back(dummy); |
| 12971 | 1312895 | } | |
| 12972 | 34128 | } | |
| 12973 |
2/4✓ Branch 0 taken 8623596 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 8623596 times.
✗ Branch 3 not taken.
|
8623596 | if(!p_igetl(&sz,f)) |
| 12974 | { | ||
| 12975 | ✗ | return qe_invalid; | |
| 12976 | } | ||
| 12977 |
2/2✓ Branch 0 taken 2253 times.
✓ Branch 1 taken 8621343 times.
|
8623596 | if(sz) //vector found |
| 12978 | { | ||
| 12979 |
1/2✓ Branch 0 taken 2253 times.
✗ Branch 1 not taken.
|
2253 | sc.vecptr = new std::vector<int32_t>(); |
| 12980 | int32_t dummy; | ||
| 12981 |
2/2✓ Branch 0 taken 14912 times.
✓ Branch 1 taken 2253 times.
|
17165 | for(size_t q = 0; q < sz; ++q) |
| 12982 | { | ||
| 12983 |
2/4✓ Branch 0 taken 14912 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 14912 times.
✗ Branch 3 not taken.
|
14912 | if(!p_igetl(&dummy,f)) |
| 12984 | { | ||
| 12985 | ✗ | return qe_invalid; | |
| 12986 | } | ||
| 12987 |
1/2✓ Branch 0 taken 14912 times.
✗ Branch 1 not taken.
|
14912 | sc.vecptr->push_back(dummy); |
| 12988 | 14912 | } | |
| 12989 | 2253 | } | |
| 12990 | 8623596 | } | |
| 12991 | 92698430 | } | |
| 12992 | |||
| 12993 | // If the first command is unknown, invalidate the whole thing. | ||
| 12994 | // Saw this for https://www.purezc.net/index.php?page=quests&id=411 hero script 0 | ||
| 12995 |
5/6✓ Branch 0 taken 1776112 times.
✓ Branch 1 taken 140726 times.
✓ Branch 2 taken 1762887 times.
✓ Branch 3 taken 13225 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 1762887 times.
|
1916838 | if (!zasm.empty() && zasm[0].command >= NUMCOMMANDS && zasm[0].command != 0xFFFF) |
| 12996 | { | ||
| 12997 | ✗ | al_trace("Warning: found script with bad instruction, disabling script: %s %d\n", ScriptTypeToString((*script)->id.type), (*script)->id.index); | |
| 12998 | ✗ | zasm.clear(); | |
| 12999 | ✗ | } | |
| 13000 | |||
| 13001 | 1916838 | zasm_script_id id = zasm_scripts.size(); | |
| 13002 |
3/6✓ Branch 0 taken 1916838 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1916838 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1916838 times.
✗ Branch 5 not taken.
|
1916838 | auto& zs = zasm_scripts.emplace_back(std::make_shared<zasm_script>(id, (*script)->name(), std::move(zasm))); |
| 13003 | 1916838 | (*script)->zasm_script = zs; | |
| 13004 | |||
| 13005 | 1916838 | return 0; | |
| 13006 | 1916838 | } | |
| 13007 | |||
| 13008 | extern SAMPLE customsfxdata[WAV_COUNT]; | ||
| 13009 | extern uint8_t customsfxflag[WAV_COUNT>>3]; | ||
| 13010 | extern int32_t sfxdat; | ||
| 13011 | extern DATAFILE *sfxdata; | ||
| 13012 | const char *old_sfx_string[Z35] = | ||
| 13013 | { | ||
| 13014 | "Arrow", "Sword beam", "Bomb blast", "Boomerang", "Subscreen cursor", | ||
| 13015 | "Shield is hit", "Item chime", "Roar (Dodongo, Gohma)", "Shutter", "Enemy dies", | ||
| 13016 | "Enemy is hit", "Low hearts warning", "Fire", "Ganon's fanfare", "Boss is hit", "Hammer", | ||
| 13017 | "Hookshot", "Message", "Player is hit", "Item fanfare", "Bomb placed", "Item pickup", | ||
| 13018 | "Refill", "Roar (Aquamentus, Gleeok, Ganon)", "Item pickup 2", "Ocean ambience", | ||
| 13019 | "Secret chime", "Player dies", "Stairs", "Sword", "Roar (Manhandla, Digdogger, Patra)", | ||
| 13020 | "Wand magic", "Whistle", "Zelda's fanfare", "Charging weapon", "Charging weapon 2", | ||
| 13021 | "Divine Fire", "Enemy falls from ceiling", "Divine Escape", "Fireball", "Tall Grass slashed", | ||
| 13022 | "Pound pounded", "Hover Boots", "Ice magic", "Jump", "Lens of Truth off", "Lens of Truth on", | ||
| 13023 | "Divine Protection shield", "Divine Protection 2", "Push block", "Rock", "Spell rocket down", | ||
| 13024 | "Spell rocket up", "Sword spin attack", "Splash", "Summon magic", "Sword tapping", | ||
| 13025 | "Sword tapping (secret)", "Whistle whirlwind", "Cane of Byrna orbit" | ||
| 13026 | }; | ||
| 13027 | char *sfx_string[WAV_COUNT]; | ||
| 13028 | |||
| 13029 | 612 | int32_t readsfx(PACKFILE *f, zquestheader *Header) | |
| 13030 | { | ||
| 13031 | //these are here to bypass compiler warnings about unused arguments | ||
| 13032 | 612 | Header=Header; | |
| 13033 | |||
| 13034 | int32_t dummy; | ||
| 13035 | 612 | word s_version=0, s_cversion=0; | |
| 13036 | //int32_t ret; | ||
| 13037 | 612 | SAMPLE temp_sample = {}; | |
| 13038 | 612 | temp_sample.loop_start=0; | |
| 13039 | 612 | temp_sample.loop_end=0; | |
| 13040 | 612 | temp_sample.param=0; | |
| 13041 | |||
| 13042 | //section version info | ||
| 13043 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 612 times.
|
612 | if(!p_igetw(&s_version,f)) |
| 13044 | { | ||
| 13045 | ✗ | return qe_invalid; | |
| 13046 | } | ||
| 13047 | |||
| 13048 | 612 | FFCore.quest_format[vSFX] = s_version; | |
| 13049 | |||
| 13050 | //al_trace("SFX version %d\n", s_version); | ||
| 13051 |
1/2✓ Branch 0 taken 612 times.
✗ Branch 1 not taken.
|
612 | if(!p_igetw(&s_cversion,f)) |
| 13052 | { | ||
| 13053 | ✗ | return qe_invalid; | |
| 13054 | } | ||
| 13055 | |||
| 13056 | //section size | ||
| 13057 |
1/2✓ Branch 0 taken 612 times.
✗ Branch 1 not taken.
|
612 | if(!p_igetl(&dummy,f)) |
| 13058 | { | ||
| 13059 | ✗ | return qe_invalid; | |
| 13060 | } | ||
| 13061 | |||
| 13062 | /* HIGHLY UNORTHODOX UPDATING THING, by L | ||
| 13063 | * This fixes quests made before revision 411 (such as the 'Lost Isle Build'), | ||
| 13064 | * where the meaning of GOTOLESS changed. It also coincided with V_SFX | ||
| 13065 | * changing from 1 to 2. | ||
| 13066 | */ | ||
| 13067 |
1/2✓ Branch 0 taken 612 times.
✗ Branch 1 not taken.
|
612 | if(s_version < 2) |
| 13068 | ✗ | set_qr(qr_GOTOLESSNOTEQUAL,1); | |
| 13069 | |||
| 13070 | /* End highly unorthodox updating thing */ | ||
| 13071 | |||
| 13072 | 612 | int32_t wavcount = WAV_COUNT; | |
| 13073 | |||
| 13074 |
1/2✓ Branch 0 taken 612 times.
✗ Branch 1 not taken.
|
612 | if(s_version < 6) |
| 13075 | ✗ | wavcount = 128; | |
| 13076 | |||
| 13077 | uint8_t tempflag[WAV_COUNT>>3]; | ||
| 13078 | |||
| 13079 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 612 times.
|
612 | if(s_version < 4) |
| 13080 | { | ||
| 13081 | ✗ | memset(tempflag, 0xFF, WAV_COUNT>>3); | |
| 13082 | ✗ | } | |
| 13083 | else | ||
| 13084 | { | ||
| 13085 |
1/2✓ Branch 0 taken 612 times.
✗ Branch 1 not taken.
|
612 | if(s_version < 6) |
| 13086 | ✗ | memset(tempflag, 0, WAV_COUNT>>3); | |
| 13087 | |||
| 13088 |
2/2✓ Branch 0 taken 19584 times.
✓ Branch 1 taken 612 times.
|
20196 | for(int32_t i=0; i<(wavcount>>3); i++) |
| 13089 | { | ||
| 13090 | 19584 | p_getc(&tempflag[i], f); | |
| 13091 | 19584 | } | |
| 13092 | |||
| 13093 | } | ||
| 13094 | |||
| 13095 |
1/2✓ Branch 0 taken 612 times.
✗ Branch 1 not taken.
|
612 | if(s_version>4) |
| 13096 | { | ||
| 13097 |
2/2✓ Branch 0 taken 156060 times.
✓ Branch 1 taken 612 times.
|
156672 | for(int32_t i=1; i<WAV_COUNT; i++) |
| 13098 | { | ||
| 13099 | 156060 | sprintf(sfx_string[i],"s%03d",i); | |
| 13100 | |||
| 13101 |
2/2✓ Branch 0 taken 119340 times.
✓ Branch 1 taken 36720 times.
|
156060 | if((i<Z35)) |
| 13102 | 36720 | strcpy(sfx_string[i], old_sfx_string[i-1]); | |
| 13103 | |||
| 13104 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 156060 times.
|
156060 | if(i>=wavcount) |
| 13105 | ✗ | continue; | |
| 13106 |
2/2✓ Branch 0 taken 36003 times.
✓ Branch 1 taken 120057 times.
|
156060 | if(get_bit(tempflag, i-1)) |
| 13107 | { | ||
| 13108 | char tempname[36]; | ||
| 13109 | |||
| 13110 |
1/2✓ Branch 0 taken 36003 times.
✗ Branch 1 not taken.
|
36003 | if(!pfread(tempname, 36, f)) |
| 13111 | { | ||
| 13112 | ✗ | return qe_invalid; | |
| 13113 | } | ||
| 13114 | |||
| 13115 | 36003 | sfx_string[i][0] = '\0'; | |
| 13116 | 36003 | strncat(sfx_string[i], tempname, 36 - 1); | |
| 13117 | 36003 | } | |
| 13118 | else | ||
| 13119 | { | ||
| 13120 | 120057 | sprintf(sfx_string[i],"s%03d",i); | |
| 13121 | |||
| 13122 |
2/2✓ Branch 0 taken 110897 times.
✓ Branch 1 taken 9160 times.
|
120057 | if(i<Z35) |
| 13123 | 9160 | strcpy(sfx_string[i], old_sfx_string[i-1]); | |
| 13124 | 120057 | sfx_string[i][35] = 0; //Force NULL Termination | |
| 13125 | } | ||
| 13126 | 156060 | } | |
| 13127 | 612 | } | |
| 13128 | else | ||
| 13129 | { | ||
| 13130 | ✗ | for(int32_t i=1; i<WAV_COUNT; i++) | |
| 13131 | { | ||
| 13132 | ✗ | sprintf(sfx_string[i],"s%03d",i); | |
| 13133 | |||
| 13134 | ✗ | if(i<Z35) | |
| 13135 | ✗ | strcpy(sfx_string[i], old_sfx_string[i-1]); | |
| 13136 | ✗ | } | |
| 13137 | } | ||
| 13138 | |||
| 13139 | //finally... section data | ||
| 13140 |
2/2✓ Branch 0 taken 156060 times.
✓ Branch 1 taken 612 times.
|
156672 | for(int32_t i=1; i<wavcount; i++) |
| 13141 | { | ||
| 13142 |
2/2✓ Branch 0 taken 36003 times.
✓ Branch 1 taken 120057 times.
|
156060 | if(get_bit(tempflag, i-1)) |
| 13143 | { | ||
| 13144 | |||
| 13145 |
1/2✓ Branch 0 taken 36003 times.
✗ Branch 1 not taken.
|
36003 | if(!p_igetl(&dummy,f)) |
| 13146 | { | ||
| 13147 | ✗ | return qe_invalid; | |
| 13148 | } | ||
| 13149 | |||
| 13150 | 36003 | (temp_sample.bits) = dummy; | |
| 13151 | |||
| 13152 |
1/2✓ Branch 0 taken 36003 times.
✗ Branch 1 not taken.
|
36003 | if(!p_igetl(&dummy,f)) |
| 13153 | { | ||
| 13154 | ✗ | return qe_invalid; | |
| 13155 | } | ||
| 13156 | |||
| 13157 | 36003 | (temp_sample.stereo) = dummy; | |
| 13158 | |||
| 13159 |
1/2✓ Branch 0 taken 36003 times.
✗ Branch 1 not taken.
|
36003 | if(!p_igetl(&dummy,f)) |
| 13160 | { | ||
| 13161 | ✗ | return qe_invalid; | |
| 13162 | } | ||
| 13163 | |||
| 13164 | 36003 | (temp_sample.freq) = dummy; | |
| 13165 | |||
| 13166 |
1/2✓ Branch 0 taken 36003 times.
✗ Branch 1 not taken.
|
36003 | if(!p_igetl(&dummy,f)) |
| 13167 | { | ||
| 13168 | ✗ | return qe_invalid; | |
| 13169 | } | ||
| 13170 | |||
| 13171 | 36003 | (temp_sample.priority) = dummy; | |
| 13172 | |||
| 13173 |
1/2✓ Branch 0 taken 36003 times.
✗ Branch 1 not taken.
|
36003 | if(!p_igetl(&(temp_sample.len),f)) |
| 13174 | { | ||
| 13175 | ✗ | return qe_invalid; | |
| 13176 | } | ||
| 13177 | |||
| 13178 |
1/2✓ Branch 0 taken 36003 times.
✗ Branch 1 not taken.
|
36003 | if(!p_igetl(&(temp_sample.loop_start),f)) |
| 13179 | { | ||
| 13180 | ✗ | return qe_invalid; | |
| 13181 | } | ||
| 13182 | |||
| 13183 |
1/2✓ Branch 0 taken 36003 times.
✗ Branch 1 not taken.
|
36003 | if(!p_igetl(&(temp_sample.loop_end),f)) |
| 13184 | { | ||
| 13185 | ✗ | return qe_invalid; | |
| 13186 | } | ||
| 13187 | |||
| 13188 |
1/2✓ Branch 0 taken 36003 times.
✗ Branch 1 not taken.
|
36003 | if(!p_igetl(&(temp_sample.param),f)) |
| 13189 | { | ||
| 13190 | ✗ | return qe_invalid; | |
| 13191 | } | ||
| 13192 | |||
| 13193 | 36003 | auto len = (temp_sample.bits==8?1:2)*(temp_sample.stereo==0?1:2)*temp_sample.len; | |
| 13194 | #ifdef ZC_FUZZ | ||
| 13195 | const int32_t sfx_limit = 100000; | ||
| 13196 | if (len < 0 || len > sfx_limit) | ||
| 13197 | { | ||
| 13198 | return qe_invalid; | ||
| 13199 | } | ||
| 13200 | #endif | ||
| 13201 | 36003 | temp_sample.data = calloc(len,1); | |
| 13202 | |||
| 13203 |
1/2✓ Branch 0 taken 36003 times.
✗ Branch 1 not taken.
|
36003 | if(s_version < 3) |
| 13204 | ✗ | len = (temp_sample.bits==8?1:2)*temp_sample.len; | |
| 13205 | |||
| 13206 | //old-style, non-portable loading (Bad Allegro! Bad!!) -DD | ||
| 13207 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 36003 times.
|
36003 | if(s_version < 2) |
| 13208 | { | ||
| 13209 | ✗ | if(!pfread(temp_sample.data, len,f)) | |
| 13210 | { | ||
| 13211 | ✗ | return qe_invalid; | |
| 13212 | } | ||
| 13213 | ✗ | } | |
| 13214 | else | ||
| 13215 | { | ||
| 13216 | //re-endianfy the data | ||
| 13217 | 36003 | int32_t wordstoread = len / sizeof(word); | |
| 13218 | |||
| 13219 |
2/2✓ Branch 0 taken 981297181 times.
✓ Branch 1 taken 36003 times.
|
981333184 | for(int32_t j=0; j<wordstoread; j++) |
| 13220 | { | ||
| 13221 | word temp; | ||
| 13222 | |||
| 13223 |
1/2✓ Branch 0 taken 981297181 times.
✗ Branch 1 not taken.
|
981297181 | if(!p_igetw(&temp, f)) |
| 13224 | { | ||
| 13225 | ✗ | return qe_invalid; | |
| 13226 | } | ||
| 13227 | |||
| 13228 | 981297181 | ((word *)temp_sample.data)[j] = temp; | |
| 13229 | 981297181 | } | |
| 13230 | } | ||
| 13231 | 36003 | } | |
| 13232 |
2/2✓ Branch 0 taken 9160 times.
✓ Branch 1 taken 110897 times.
|
120057 | else if(i < Z35) |
| 13233 | { | ||
| 13234 | 9160 | SAMPLE* datsamp = (SAMPLE*)(sfxdata[i].dat); | |
| 13235 | 9160 | memcpy(&temp_sample, datsamp, sizeof(SAMPLE)); | |
| 13236 | 9160 | set_bit(tempflag, i-1, 1); | |
| 13237 | 9160 | int32_t len = (temp_sample.bits==8?1:2)*(temp_sample.stereo==0?1:2)*temp_sample.len; | |
| 13238 | 9160 | temp_sample.data = calloc(len,1); | |
| 13239 | 9160 | memcpy(temp_sample.data, datsamp->data, len); | |
| 13240 | 9160 | } | |
| 13241 | 110897 | else continue; | |
| 13242 | |||
| 13243 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 45163 times.
|
45163 | if(customsfxdata[i].data!=NULL) |
| 13244 | { | ||
| 13245 | // delete [] customsfxdata[i].data; | ||
| 13246 | 45163 | free(customsfxdata[i].data); | |
| 13247 | 45163 | } | |
| 13248 | |||
| 13249 | // customsfxdata[i].data = new byte[(temp_sample.bits==8?1:2)*temp_sample.len]; | ||
| 13250 | 45163 | int32_t len2 = (temp_sample.bits==8?1:2)*(temp_sample.stereo==0?1:2)*temp_sample.len; | |
| 13251 | 45163 | customsfxdata[i].data = calloc(len2,1); | |
| 13252 | 45163 | customsfxdata[i].bits = temp_sample.bits; | |
| 13253 | 45163 | customsfxdata[i].stereo = temp_sample.stereo; | |
| 13254 | 45163 | customsfxdata[i].freq = temp_sample.freq; | |
| 13255 | 45163 | customsfxdata[i].priority = temp_sample.priority; | |
| 13256 | 45163 | customsfxdata[i].len = temp_sample.len; | |
| 13257 | 45163 | customsfxdata[i].loop_start = temp_sample.loop_start; | |
| 13258 | 45163 | customsfxdata[i].loop_end = temp_sample.loop_end; | |
| 13259 | 45163 | customsfxdata[i].param = temp_sample.param; | |
| 13260 | 45163 | int32_t cpylen = len2; | |
| 13261 | |||
| 13262 |
1/2✓ Branch 0 taken 45163 times.
✗ Branch 1 not taken.
|
45163 | if(s_version<3) |
| 13263 | { | ||
| 13264 | ✗ | cpylen = (temp_sample.bits==8?1:2)*temp_sample.len; | |
| 13265 | ✗ | al_trace("WARNING: Quest SFX %d is in stereo, and may be corrupt.\n",i); | |
| 13266 | ✗ | } | |
| 13267 | |||
| 13268 | 45163 | memcpy(customsfxdata[i].data,temp_sample.data,cpylen); | |
| 13269 | |||
| 13270 | 45163 | free(temp_sample.data); | |
| 13271 | 45163 | } | |
| 13272 | |||
| 13273 | 612 | memcpy(customsfxflag, tempflag, WAV_COUNT>>3); | |
| 13274 | |||
| 13275 | 612 | sfxdat=0; | |
| 13276 | 612 | return 0; | |
| 13277 | 612 | } | |
| 13278 | |||
| 13279 | 694 | void setupsfx() | |
| 13280 | { | ||
| 13281 |
2/2✓ Branch 0 taken 176970 times.
✓ Branch 1 taken 694 times.
|
177664 | for(int32_t i=1; i<WAV_COUNT; i++) |
| 13282 | { | ||
| 13283 | 176970 | sprintf(sfx_string[i],"s%03d",i); | |
| 13284 | |||
| 13285 |
2/2✓ Branch 0 taken 135330 times.
✓ Branch 1 taken 41640 times.
|
176970 | if(i<Z35) |
| 13286 | { | ||
| 13287 | 41640 | strcpy(sfx_string[i], old_sfx_string[i-1]); | |
| 13288 | 41640 | } | |
| 13289 | |||
| 13290 | 176970 | memset(customsfxflag, 0, WAV_COUNT>>3); | |
| 13291 | |||
| 13292 | 176970 | int32_t j=i; | |
| 13293 | |||
| 13294 |
2/2✓ Branch 0 taken 42334 times.
✓ Branch 1 taken 134636 times.
|
176970 | if(i>Z35) |
| 13295 | { | ||
| 13296 | 134636 | i=Z35; | |
| 13297 | 134636 | } | |
| 13298 | |||
| 13299 | 176970 | SAMPLE *temp_sample = (SAMPLE *)sfxdata[i].dat; | |
| 13300 | |||
| 13301 |
2/2✓ Branch 0 taken 79815 times.
✓ Branch 1 taken 97155 times.
|
176970 | if(customsfxdata[j].data!=NULL) |
| 13302 | { | ||
| 13303 | // delete [] customsfxdata[j].data; | ||
| 13304 | 97155 | free(customsfxdata[j].data); | |
| 13305 | 97155 | } | |
| 13306 | |||
| 13307 | // customsfxdata[j].data = new byte[(temp_sample->bits==8?1:2)*temp_sample->len]; | ||
| 13308 | 176970 | customsfxdata[j].data = calloc((temp_sample->bits==8?1:2)*(temp_sample->stereo == 0 ? 1 : 2)*temp_sample->len,1); | |
| 13309 | 176970 | customsfxdata[j].bits = temp_sample->bits; | |
| 13310 | 176970 | customsfxdata[j].stereo = temp_sample->stereo; | |
| 13311 | 176970 | customsfxdata[j].freq = temp_sample->freq; | |
| 13312 | 176970 | customsfxdata[j].priority = temp_sample->priority; | |
| 13313 | 176970 | customsfxdata[j].len = temp_sample->len; | |
| 13314 | 176970 | customsfxdata[j].loop_start = temp_sample->loop_start; | |
| 13315 | 176970 | customsfxdata[j].loop_end = temp_sample->loop_end; | |
| 13316 | 176970 | customsfxdata[j].param = temp_sample->param; | |
| 13317 | 176970 | memcpy(customsfxdata[j].data, (temp_sample->data), (temp_sample->bits==8?1:2)*(temp_sample->stereo==0 ? 1 : 2)*temp_sample->len); | |
| 13318 | 176970 | i=j; | |
| 13319 | 176970 | } | |
| 13320 | 694 | } | |
| 13321 | |||
| 13322 | extern char *guy_string[eMAXGUYS]; | ||
| 13323 | extern const char *old_guy_string[OLDMAXGUYS]; | ||
| 13324 | |||
| 13325 | 694 | int32_t readguys(PACKFILE *f, zquestheader *Header) | |
| 13326 | { | ||
| 13327 |
2/2✓ Branch 0 taken 671 times.
✓ Branch 1 taken 23 times.
|
694 | bool should_skip = legacy_skip_flags && get_bit(legacy_skip_flags, skip_guys); |
| 13328 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 694 times.
|
694 | if (should_skip) return 0; |
| 13329 | |||
| 13330 | dword dummy; | ||
| 13331 | word guy_cversion; | ||
| 13332 | 694 | word guyversion=0; | |
| 13333 | |||
| 13334 |
2/2✓ Branch 0 taken 23 times.
✓ Branch 1 taken 671 times.
|
694 | if(Header->zelda_version >= 0x193) |
| 13335 | { | ||
| 13336 | //section version info | ||
| 13337 |
1/2✓ Branch 0 taken 671 times.
✗ Branch 1 not taken.
|
671 | if(!p_igetw(&guyversion,f)) |
| 13338 | { | ||
| 13339 | ✗ | return qe_invalid; | |
| 13340 | } | ||
| 13341 | |||
| 13342 | 671 | FFCore.quest_format[vGuys] = guyversion; | |
| 13343 | |||
| 13344 | //al_trace("Guys version %d\n", guyversion); | ||
| 13345 |
1/2✓ Branch 0 taken 671 times.
✗ Branch 1 not taken.
|
671 | if(!p_igetw(&guy_cversion,f)) |
| 13346 | { | ||
| 13347 | ✗ | return qe_invalid; | |
| 13348 | } | ||
| 13349 | 671 | al_trace("Guy CVersion is: %d\n", guy_cversion); | |
| 13350 | //section size | ||
| 13351 |
1/2✓ Branch 0 taken 671 times.
✗ Branch 1 not taken.
|
671 | if(!p_igetl(&dummy,f)) |
| 13352 | { | ||
| 13353 | ✗ | return qe_invalid; | |
| 13354 | } | ||
| 13355 | 671 | } | |
| 13356 | |||
| 13357 |
2/2✓ Branch 0 taken 612 times.
✓ Branch 1 taken 82 times.
|
694 | if(guyversion > 3) |
| 13358 | { | ||
| 13359 |
2/2✓ Branch 0 taken 313344 times.
✓ Branch 1 taken 612 times.
|
313956 | for(int32_t i=0; i<MAXGUYS; i++) |
| 13360 | { | ||
| 13361 | char tempname[64]; | ||
| 13362 | |||
| 13363 | // rev. 1511 : guyversion = 23. upped to 512 editable enemies. -Gleeok | ||
| 13364 | // if guyversion < 23 then there is only 256 enemies in the packfile, so default the rest. | ||
| 13365 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 313344 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
313344 | if(guyversion < 23 && i >= OLDBETAMAXGUYS) |
| 13366 | { | ||
| 13367 | ✗ | memset(tempname, 0, sizeof(char)*64); | |
| 13368 | ✗ | sprintf(tempname, "e%03d", i); | |
| 13369 | ✗ | strcpy(guy_string[i], tempname); | |
| 13370 | |||
| 13371 | ✗ | continue; | |
| 13372 | } | ||
| 13373 | |||
| 13374 |
1/2✓ Branch 0 taken 313344 times.
✗ Branch 1 not taken.
|
313344 | if(!pfread(tempname, 64, f)) |
| 13375 | { | ||
| 13376 | ✗ | return qe_invalid; | |
| 13377 | } | ||
| 13378 | |||
| 13379 | // Don't retain names of uneditable enemy entries! | ||
| 13380 | // for version upgrade to 2.5 | ||
| 13381 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 313344 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
313344 | if(guyversion < 23 && i >= 177) |
| 13382 | { | ||
| 13383 | // some of the older builds have names such as 'zz123', | ||
| 13384 | // (this order gets messed up with some eXXX and some zzXXX) | ||
| 13385 | // so let's update to the newer naming convection. -Gleeok | ||
| 13386 | char tmpbuf[64]; | ||
| 13387 | ✗ | memset(tmpbuf, 0, sizeof(char)*64); | |
| 13388 | ✗ | sprintf(tmpbuf, "zz%03d", i); | |
| 13389 | |||
| 13390 | ✗ | if(memcmp(tempname, tmpbuf, size_t(5)) == 0) | |
| 13391 | { | ||
| 13392 | ✗ | memset(tempname, 0, sizeof(char)*64); | |
| 13393 | ✗ | sprintf(tempname, "e%03d", i); | |
| 13394 | ✗ | } | |
| 13395 | ✗ | } | |
| 13396 | |||
| 13397 |
6/6✓ Branch 0 taken 108324 times.
✓ Branch 1 taken 205020 times.
✓ Branch 2 taken 102816 times.
✓ Branch 3 taken 5508 times.
✓ Branch 4 taken 93583 times.
✓ Branch 5 taken 9233 times.
|
313344 | if(i >= OLDMAXGUYS || strlen(tempname)<1 || tempname[strlen(tempname)-1]!=' ') |
| 13398 | { | ||
| 13399 | 304111 | guy_string[i][0] = '\0'; | |
| 13400 | 304111 | strncat(guy_string[i], tempname, 64 - 1); | |
| 13401 | 304111 | } | |
| 13402 | else | ||
| 13403 | { | ||
| 13404 | 9233 | strcpy(guy_string[i],old_guy_string[i]); | |
| 13405 | } | ||
| 13406 | 313344 | } | |
| 13407 | 612 | } | |
| 13408 | else | ||
| 13409 | { | ||
| 13410 |
2/2✓ Branch 0 taken 41984 times.
✓ Branch 1 taken 82 times.
|
42066 | for(int32_t i=0; i<eMAXGUYS; i++) |
| 13411 | { | ||
| 13412 | 41984 | sprintf(guy_string[i],"zz%03d",i); | |
| 13413 | 41984 | } | |
| 13414 | |||
| 13415 |
2/2✓ Branch 0 taken 14514 times.
✓ Branch 1 taken 82 times.
|
14596 | for(int32_t i=0; i<OLDMAXGUYS; i++) |
| 13416 | { | ||
| 13417 | 14514 | strcpy(guy_string[i],old_guy_string[i]); | |
| 13418 | 14514 | } | |
| 13419 | } | ||
| 13420 | |||
| 13421 | |||
| 13422 | //finally... section data | ||
| 13423 | 694 | init_guys(guyversion); //using default data for now... | |
| 13424 | |||
| 13425 | // Goriya guy fix | ||
| 13426 |
3/6✓ Branch 0 taken 612 times.
✓ Branch 1 taken 82 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 612 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
694 | if((Header->zelda_version < 0x211)||((Header->zelda_version == 0x211)&&(Header->build<7))) |
| 13427 | { | ||
| 13428 |
2/2✓ Branch 0 taken 22 times.
✓ Branch 1 taken 60 times.
|
82 | if(get_qr(qr_NEWENEMYTILES)) |
| 13429 | { | ||
| 13430 | 60 | guysbuf[gGORIYA].tile=130; | |
| 13431 | 60 | guysbuf[gGORIYA].e_tile=130; | |
| 13432 | 60 | } | |
| 13433 | 82 | } | |
| 13434 | |||
| 13435 |
2/2✓ Branch 0 taken 671 times.
✓ Branch 1 taken 23 times.
|
694 | if(Header->zelda_version < 0x193) |
| 13436 | { | ||
| 13437 |
2/2✓ Branch 0 taken 18 times.
✓ Branch 1 taken 5 times.
|
23 | if(get_bit(deprecated_rules,46)) |
| 13438 | { | ||
| 13439 | 5 | guysbuf[eDODONGO].cset=14; | |
| 13440 | 5 | guysbuf[eDODONGO].bosspal=spDIG; | |
| 13441 | 5 | } | |
| 13442 | 23 | } | |
| 13443 | // Not sure when this first changed, but it's necessary for 2.10, at least | ||
| 13444 | // @TODO: @BUG:1.92 - 1.84? Figure this out exactly for the final 2.50 release. | ||
| 13445 | //2.10 Fixes | ||
| 13446 |
3/6✓ Branch 0 taken 612 times.
✓ Branch 1 taken 82 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 612 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
694 | if((Header->zelda_version < 0x211)||((Header->zelda_version == 0x211)&&(Header->build<18))) |
| 13447 | { | ||
| 13448 | 82 | guysbuf[eWWIZ].editorflags |= ENEMY_FLAG5; | |
| 13449 | 82 | guysbuf[eMOLDORM].editorflags |= ENEMY_FLAG6; | |
| 13450 | 82 | guysbuf[eMANHAN].editorflags |= ENEMY_FLAG6; | |
| 13451 | 82 | guysbuf[eCENT1].misc3 = 1; | |
| 13452 | 82 | guysbuf[eCENT2].misc3 = 1; | |
| 13453 | 82 | } | |
| 13454 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 694 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
694 | if((Header->zelda_version <= 0x255) || (Header->zelda_version == 0x255 && Header->build < 47) ) |
| 13455 | { | ||
| 13456 | 694 | guysbuf[eWPOLSV].defense[edefWhistle] = ed1HKO; | |
| 13457 | 694 | } | |
| 13458 |
2/2✓ Branch 0 taken 612 times.
✓ Branch 1 taken 82 times.
|
694 | if(Header->zelda_version <= 0x210) |
| 13459 | { | ||
| 13460 | 82 | guysbuf[eGLEEOK1F].misc6 = 16; | |
| 13461 | 82 | guysbuf[eGLEEOK2F].misc6 = 16; | |
| 13462 | 82 | guysbuf[eGLEEOK3F].misc6 = 16; | |
| 13463 | 82 | guysbuf[eGLEEOK4F].misc6 = 16; | |
| 13464 | |||
| 13465 | 82 | guysbuf[eWIZ1].misc4 = 1; //only set the enemy that needs backward compat, not all of them. | |
| 13466 | 82 | guysbuf[eBATROBE].misc4 = 1; | |
| 13467 | //guysbuf[eSUMMONER].misc4 = 1; | ||
| 13468 | 82 | guysbuf[eWWIZ].misc4 = 1; | |
| 13469 | 82 | guysbuf[eDODONGO].deadsfx = 15; //In 2.10 and earlier, Dodongos used this as their death sound. | |
| 13470 | 82 | guysbuf[eDODONGOBS].deadsfx = 15; //In 2.10 and earlier, Dodongos used this as their death sound. | |
| 13471 | 82 | } | |
| 13472 |
2/2✓ Branch 0 taken 682 times.
✓ Branch 1 taken 12 times.
|
694 | if(Header->zelda_version == 0x190) |
| 13473 | { | ||
| 13474 | 12 | al_trace("Setting Tribble Properties for Version: %x", Header->zelda_version); | |
| 13475 | 12 | guysbuf[eKEESETRIB].misc3 = eVIRE; //1.90 and earlier, keese and gel tribbles grew up into | |
| 13476 | 12 | guysbuf[eGELTRIB].misc3 = eZOL; //normal vires, and zols -Z (16th January, 2019 ) | |
| 13477 | 12 | } | |
| 13478 | |||
| 13479 | // The versions here may not be correct | ||
| 13480 | // zelda_version>=0x211 handled at guyversion<24 | ||
| 13481 |
2/2✓ Branch 0 taken 18 times.
✓ Branch 1 taken 676 times.
|
694 | if(Header->zelda_version <= 0x190) |
| 13482 | { | ||
| 13483 | 18 | guysbuf[eCENT1].misc3 = 0; | |
| 13484 | 18 | guysbuf[eCENT2].misc3 = 0; | |
| 13485 | 18 | guysbuf[eMOLDORM].misc2 = 0; | |
| 13486 | //guysbuf[eKEESETRIB].misc3 = eVIRE; //1.90 and earlier, keese and gel tribbles grew up into | ||
| 13487 | //guysbuf[eGELTRIB].misc3 = eZOL; //normal vires, and zols -Z (16th January, 2019 ) | ||
| 13488 | 18 | } | |
| 13489 |
2/2✓ Branch 0 taken 612 times.
✓ Branch 1 taken 64 times.
|
676 | else if(Header->zelda_version <= 0x210) |
| 13490 | { | ||
| 13491 | 64 | guysbuf[eCENT1].misc3 = 1; | |
| 13492 | 64 | guysbuf[eCENT2].misc3 = 1; | |
| 13493 | 64 | guysbuf[eMOLDORM].misc2 = 0; | |
| 13494 | 64 | } | |
| 13495 | |||
| 13496 |
2/2✓ Branch 0 taken 612 times.
✓ Branch 1 taken 82 times.
|
694 | if ( Header->zelda_version < 0x211 ) //Default rest rates for phantom ghinis, peahats and keese in < 2.50 quests |
| 13497 | { | ||
| 13498 | 82 | guysbuf[eKEESE1].misc16 = 120; | |
| 13499 | 82 | guysbuf[eKEESE2].misc16 = 120; | |
| 13500 | 82 | guysbuf[eKEESE3].misc16 = 120; | |
| 13501 | 82 | guysbuf[eKEESETRIB].misc16 = 120; | |
| 13502 | 82 | guysbuf[eKEESE1].misc17 = 16; | |
| 13503 | 82 | guysbuf[eKEESE2].misc17 = 16; | |
| 13504 | 82 | guysbuf[eKEESE3].misc17 = 16; | |
| 13505 | 82 | guysbuf[eKEESETRIB].misc17 = 16; | |
| 13506 | |||
| 13507 | 82 | guysbuf[ePEAHAT].misc16 = 80; | |
| 13508 | 82 | guysbuf[ePEAHAT].misc17 = 16; | |
| 13509 | |||
| 13510 | 82 | guysbuf[eGHINI2].misc16 = 120; | |
| 13511 | 82 | guysbuf[eGHINI2].misc17 = 10; | |
| 13512 | |||
| 13513 |
2/2✓ Branch 0 taken 16 times.
✓ Branch 1 taken 66 times.
|
82 | if (replay_version_check(20)) |
| 13514 | { | ||
| 13515 | 66 | guysbuf[eGHINI2].moveflags |= (FLAG_CAN_WATERWALK|FLAG_CAN_PITWALK); | |
| 13516 | 66 | guysbuf[eMOLDORM].moveflags |= (FLAG_CAN_WATERWALK|FLAG_CAN_PITWALK); | |
| 13517 | 66 | guysbuf[eKEESETRIB].moveflags |= (FLAG_CAN_WATERWALK|FLAG_CAN_PITWALK); | |
| 13518 | 66 | guysbuf[eKEESE3].moveflags |= (FLAG_CAN_WATERWALK|FLAG_CAN_PITWALK); | |
| 13519 | 66 | guysbuf[eKEESE2].moveflags |= (FLAG_CAN_WATERWALK|FLAG_CAN_PITWALK); | |
| 13520 | 66 | guysbuf[eKEESE1].moveflags |= (FLAG_CAN_WATERWALK|FLAG_CAN_PITWALK); | |
| 13521 | 66 | guysbuf[eTEK1].moveflags |= (FLAG_CAN_WATERWALK|FLAG_CAN_PITWALK); | |
| 13522 | 66 | guysbuf[eTEK2].moveflags |= (FLAG_CAN_WATERWALK|FLAG_CAN_PITWALK); | |
| 13523 | 66 | guysbuf[ePEAHAT].moveflags |= (FLAG_CAN_WATERWALK|FLAG_CAN_PITWALK); | |
| 13524 | 66 | guysbuf[eROCK].moveflags |= (FLAG_CAN_WATERWALK|FLAG_CAN_PITWALK); | |
| 13525 | 66 | guysbuf[eTRAP].moveflags |= (FLAG_CAN_WATERWALK|FLAG_CAN_PITWALK); | |
| 13526 | 66 | guysbuf[eWALLM].moveflags |= (FLAG_CAN_WATERWALK|FLAG_CAN_PITWALK); | |
| 13527 | 66 | guysbuf[ePOLSV].moveflags |= (FLAG_CAN_WATERWALK|FLAG_CAN_PITWALK); | |
| 13528 | 66 | guysbuf[eMANHAN].moveflags |= (FLAG_CAN_WATERWALK|FLAG_CAN_PITWALK); | |
| 13529 | 66 | guysbuf[eGLEEOK1].moveflags |= (FLAG_CAN_WATERWALK|FLAG_CAN_PITWALK); | |
| 13530 | 66 | guysbuf[eGLEEOK2].moveflags |= (FLAG_CAN_WATERWALK|FLAG_CAN_PITWALK); | |
| 13531 | 66 | guysbuf[eGLEEOK3].moveflags |= (FLAG_CAN_WATERWALK|FLAG_CAN_PITWALK); | |
| 13532 | 66 | guysbuf[eGLEEOK4].moveflags |= (FLAG_CAN_WATERWALK|FLAG_CAN_PITWALK); | |
| 13533 | 66 | guysbuf[eDIG1].moveflags |= (FLAG_CAN_WATERWALK|FLAG_CAN_PITWALK); | |
| 13534 | 66 | guysbuf[eDIG3].moveflags |= (FLAG_CAN_WATERWALK|FLAG_CAN_PITWALK); | |
| 13535 | 66 | guysbuf[eDIGPUP1].moveflags |= (FLAG_CAN_WATERWALK|FLAG_CAN_PITWALK); | |
| 13536 | 66 | guysbuf[eDIGPUP2].moveflags |= (FLAG_CAN_WATERWALK|FLAG_CAN_PITWALK); | |
| 13537 | 66 | guysbuf[eDIGPUP3].moveflags |= (FLAG_CAN_WATERWALK|FLAG_CAN_PITWALK); | |
| 13538 | 66 | guysbuf[eDIGPUP4].moveflags |= (FLAG_CAN_WATERWALK|FLAG_CAN_PITWALK); | |
| 13539 | 66 | guysbuf[eRAQUAM].moveflags |= (FLAG_CAN_WATERWALK|FLAG_CAN_PITWALK); | |
| 13540 | 66 | guysbuf[eITEMFAIRY].moveflags |= (FLAG_CAN_WATERWALK|FLAG_CAN_PITWALK); | |
| 13541 | 66 | guysbuf[eFIRE].moveflags |= (FLAG_CAN_WATERWALK|FLAG_CAN_PITWALK); | |
| 13542 | 66 | guysbuf[eMANHAN2].moveflags |= (FLAG_CAN_WATERWALK|FLAG_CAN_PITWALK); | |
| 13543 | 66 | guysbuf[eTRAP_H].moveflags |= (FLAG_CAN_WATERWALK|FLAG_CAN_PITWALK); | |
| 13544 | 66 | guysbuf[eTRAP_V].moveflags |= (FLAG_CAN_WATERWALK|FLAG_CAN_PITWALK); | |
| 13545 | 66 | guysbuf[eTRAP_LR].moveflags |= (FLAG_CAN_WATERWALK|FLAG_CAN_PITWALK); | |
| 13546 | 66 | guysbuf[eTRAP_UD].moveflags |= (FLAG_CAN_WATERWALK|FLAG_CAN_PITWALK); | |
| 13547 | 66 | guysbuf[ePATRA1].moveflags |= (FLAG_CAN_WATERWALK|FLAG_CAN_PITWALK); | |
| 13548 | 66 | guysbuf[ePATRA2].moveflags |= (FLAG_CAN_WATERWALK|FLAG_CAN_PITWALK); | |
| 13549 | 66 | guysbuf[ePATRABS].moveflags |= (FLAG_CAN_WATERWALK|FLAG_CAN_PITWALK); | |
| 13550 | 66 | guysbuf[eBAT].moveflags |= (FLAG_CAN_WATERWALK|FLAG_CAN_PITWALK); | |
| 13551 | 66 | guysbuf[eGLEEOK1F].moveflags |= (FLAG_CAN_WATERWALK|FLAG_CAN_PITWALK); | |
| 13552 | 66 | guysbuf[eGLEEOK2F].moveflags |= (FLAG_CAN_WATERWALK|FLAG_CAN_PITWALK); | |
| 13553 | 66 | guysbuf[eGLEEOK3F].moveflags |= (FLAG_CAN_WATERWALK|FLAG_CAN_PITWALK); | |
| 13554 | 66 | guysbuf[eGLEEOK4F].moveflags |= (FLAG_CAN_WATERWALK|FLAG_CAN_PITWALK); | |
| 13555 | 66 | guysbuf[eTRIGGER].moveflags |= (FLAG_CAN_WATERWALK|FLAG_CAN_PITWALK); | |
| 13556 | 66 | guysbuf[ePATRAL2].moveflags |= (FLAG_CAN_WATERWALK|FLAG_CAN_PITWALK); | |
| 13557 | 66 | guysbuf[ePATRAL3].moveflags |= (FLAG_CAN_WATERWALK|FLAG_CAN_PITWALK); | |
| 13558 | 66 | guysbuf[eGOHMA1].moveflags |= (FLAG_CAN_WATERWALK|FLAG_CAN_PITWALK); | |
| 13559 | 66 | guysbuf[eGOHMA2].moveflags |= (FLAG_CAN_WATERWALK|FLAG_CAN_PITWALK); | |
| 13560 | 66 | guysbuf[eGOHMA3].moveflags |= (FLAG_CAN_WATERWALK|FLAG_CAN_PITWALK); | |
| 13561 | 66 | guysbuf[eGOHMA4].moveflags |= (FLAG_CAN_WATERWALK|FLAG_CAN_PITWALK); | |
| 13562 | 66 | guysbuf[eMPOLSV].moveflags |= (FLAG_CAN_WATERWALK|FLAG_CAN_PITWALK); | |
| 13563 | 66 | guysbuf[eWPOLSV].moveflags |= (FLAG_CAN_WATERWALK|FLAG_CAN_PITWALK); | |
| 13564 | 66 | } | |
| 13565 | 82 | } | |
| 13566 | |||
| 13567 | |||
| 13568 |
2/2✓ Branch 0 taken 82 times.
✓ Branch 1 taken 612 times.
|
694 | if(guyversion<=2) |
| 13569 | { | ||
| 13570 | 82 | return readherosprites2(f, guyversion==2?0:-1, 0); | |
| 13571 | } | ||
| 13572 | |||
| 13573 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 612 times.
|
612 | if(guyversion > 3) |
| 13574 | { | ||
| 13575 | guydata tempguy; | ||
| 13576 | |||
| 13577 |
2/2✓ Branch 0 taken 313344 times.
✓ Branch 1 taken 612 times.
|
313956 | for(int32_t i=0; i<MAXGUYS; i++) |
| 13578 | { | ||
| 13579 |
1/2✓ Branch 0 taken 313344 times.
✗ Branch 1 not taken.
|
313344 | if(guyversion < 23) // May 2012 : 512 max enemies |
| 13580 | { | ||
| 13581 | ✗ | if(i >= OLDBETAMAXGUYS) | |
| 13582 | { | ||
| 13583 | ✗ | memset(&guysbuf[i], 0, sizeof(guydata)); | |
| 13584 | ✗ | continue; | |
| 13585 | } | ||
| 13586 | ✗ | } | |
| 13587 | |||
| 13588 | 313344 | memset(&tempguy, 0, sizeof(guydata)); | |
| 13589 | |||
| 13590 |
1/2✓ Branch 0 taken 313344 times.
✗ Branch 1 not taken.
|
313344 | if(!p_igetl(&(tempguy.flags),f)) |
| 13591 | { | ||
| 13592 | ✗ | return qe_invalid; | |
| 13593 | } | ||
| 13594 | |||
| 13595 |
1/2✓ Branch 0 taken 313344 times.
✗ Branch 1 not taken.
|
313344 | if(!p_igetl(&(tempguy.flags2),f)) |
| 13596 | { | ||
| 13597 | ✗ | return qe_invalid; | |
| 13598 | } | ||
| 13599 | |||
| 13600 |
2/2✓ Branch 0 taken 216576 times.
✓ Branch 1 taken 96768 times.
|
313344 | if ( guyversion >= 36 ) //expanded tiles |
| 13601 | { | ||
| 13602 |
1/2✓ Branch 0 taken 216576 times.
✗ Branch 1 not taken.
|
216576 | if(!p_igetl(&(tempguy.tile),f)) |
| 13603 | { | ||
| 13604 | ✗ | return qe_invalid; | |
| 13605 | } | ||
| 13606 | 216576 | } | |
| 13607 | else | ||
| 13608 | { | ||
| 13609 |
1/2✓ Branch 0 taken 96768 times.
✗ Branch 1 not taken.
|
96768 | if(!p_igetw(&(tempguy.tile),f)) |
| 13610 | { | ||
| 13611 | ✗ | return qe_invalid; | |
| 13612 | } | ||
| 13613 | } | ||
| 13614 |
1/2✓ Branch 0 taken 313344 times.
✗ Branch 1 not taken.
|
313344 | if(!p_getc(&(tempguy.width),f)) |
| 13615 | { | ||
| 13616 | ✗ | return qe_invalid; | |
| 13617 | } | ||
| 13618 | |||
| 13619 |
1/2✓ Branch 0 taken 313344 times.
✗ Branch 1 not taken.
|
313344 | if(!p_getc(&(tempguy.height),f)) |
| 13620 | { | ||
| 13621 | ✗ | return qe_invalid; | |
| 13622 | } | ||
| 13623 | |||
| 13624 |
2/2✓ Branch 0 taken 216576 times.
✓ Branch 1 taken 96768 times.
|
313344 | if ( guyversion >= 36 ) //expanded tiles |
| 13625 | { | ||
| 13626 |
1/2✓ Branch 0 taken 216576 times.
✗ Branch 1 not taken.
|
216576 | if(!p_igetl(&(tempguy.s_tile),f)) |
| 13627 | { | ||
| 13628 | ✗ | return qe_invalid; | |
| 13629 | } | ||
| 13630 | 216576 | } | |
| 13631 | else | ||
| 13632 | { | ||
| 13633 |
1/2✓ Branch 0 taken 96768 times.
✗ Branch 1 not taken.
|
96768 | if(!p_igetw(&(tempguy.s_tile),f)) |
| 13634 | { | ||
| 13635 | ✗ | return qe_invalid; | |
| 13636 | } | ||
| 13637 | } | ||
| 13638 | |||
| 13639 |
1/2✓ Branch 0 taken 313344 times.
✗ Branch 1 not taken.
|
313344 | if(!p_getc(&(tempguy.s_width),f)) |
| 13640 | { | ||
| 13641 | ✗ | return qe_invalid; | |
| 13642 | } | ||
| 13643 | |||
| 13644 |
1/2✓ Branch 0 taken 313344 times.
✗ Branch 1 not taken.
|
313344 | if(!p_getc(&(tempguy.s_height),f)) |
| 13645 | { | ||
| 13646 | ✗ | return qe_invalid; | |
| 13647 | } | ||
| 13648 | |||
| 13649 |
2/2✓ Branch 0 taken 216576 times.
✓ Branch 1 taken 96768 times.
|
313344 | if ( guyversion >= 36 ) //expanded tiles |
| 13650 | { | ||
| 13651 |
1/2✓ Branch 0 taken 216576 times.
✗ Branch 1 not taken.
|
216576 | if(!p_igetl(&(tempguy.e_tile),f)) |
| 13652 | { | ||
| 13653 | ✗ | return qe_invalid; | |
| 13654 | } | ||
| 13655 | 216576 | } | |
| 13656 | else | ||
| 13657 | { | ||
| 13658 |
1/2✓ Branch 0 taken 96768 times.
✗ Branch 1 not taken.
|
96768 | if(!p_igetw(&(tempguy.e_tile),f)) |
| 13659 | { | ||
| 13660 | ✗ | return qe_invalid; | |
| 13661 | } | ||
| 13662 | } | ||
| 13663 | |||
| 13664 |
1/2✓ Branch 0 taken 313344 times.
✗ Branch 1 not taken.
|
313344 | if(!p_getc(&(tempguy.e_width),f)) |
| 13665 | { | ||
| 13666 | ✗ | return qe_invalid; | |
| 13667 | } | ||
| 13668 | |||
| 13669 |
1/2✓ Branch 0 taken 313344 times.
✗ Branch 1 not taken.
|
313344 | if(!p_getc(&(tempguy.e_height),f)) |
| 13670 | { | ||
| 13671 | ✗ | return qe_invalid; | |
| 13672 | } | ||
| 13673 | |||
| 13674 |
1/2✓ Branch 0 taken 313344 times.
✗ Branch 1 not taken.
|
313344 | if(!p_igetw(&(tempguy.hp),f)) |
| 13675 | { | ||
| 13676 | ✗ | return qe_invalid; | |
| 13677 | } | ||
| 13678 | |||
| 13679 |
1/2✓ Branch 0 taken 313344 times.
✗ Branch 1 not taken.
|
313344 | if(!p_igetw(&(tempguy.family),f)) |
| 13680 | { | ||
| 13681 | ✗ | return qe_invalid; | |
| 13682 | } | ||
| 13683 | |||
| 13684 |
1/12✗ Branch 0 not taken.
✓ Branch 1 taken 313344 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
|
313344 | if(guyversion < 9 && (i==eDKNUT1 || i==eDKNUT2 || i==eDKNUT3 || i==eDKNUT4 || i==eDKNUT5)) // Whoops, forgot about Darknuts... |
| 13685 | { | ||
| 13686 | ✗ | if(get_qr(qr_NEWENEMYTILES)) | |
| 13687 | { | ||
| 13688 | ✗ | tempguy.s_tile=tempguy.e_tile+120; | |
| 13689 | ✗ | tempguy.s_width=tempguy.e_width; | |
| 13690 | ✗ | tempguy.s_height=tempguy.e_height; | |
| 13691 | ✗ | } | |
| 13692 | ✗ | else tempguy.s_tile=860; | |
| 13693 | ✗ | } | |
| 13694 | |||
| 13695 |
1/2✓ Branch 0 taken 313344 times.
✗ Branch 1 not taken.
|
313344 | if(!p_igetw(&(tempguy.cset),f)) |
| 13696 | { | ||
| 13697 | ✗ | return qe_invalid; | |
| 13698 | } | ||
| 13699 | |||
| 13700 |
1/2✓ Branch 0 taken 313344 times.
✗ Branch 1 not taken.
|
313344 | if(!p_igetw(&(tempguy.anim),f)) |
| 13701 | { | ||
| 13702 | ✗ | return qe_invalid; | |
| 13703 | } | ||
| 13704 | |||
| 13705 |
1/2✓ Branch 0 taken 313344 times.
✗ Branch 1 not taken.
|
313344 | if(!p_igetw(&(tempguy.e_anim),f)) |
| 13706 | { | ||
| 13707 | ✗ | return qe_invalid; | |
| 13708 | } | ||
| 13709 | |||
| 13710 |
1/2✓ Branch 0 taken 313344 times.
✗ Branch 1 not taken.
|
313344 | if(!p_igetw(&(tempguy.frate),f)) |
| 13711 | { | ||
| 13712 | ✗ | return qe_invalid; | |
| 13713 | } | ||
| 13714 | |||
| 13715 |
1/2✓ Branch 0 taken 313344 times.
✗ Branch 1 not taken.
|
313344 | if(!p_igetw(&(tempguy.e_frate),f)) |
| 13716 | { | ||
| 13717 | ✗ | return qe_invalid; | |
| 13718 | } | ||
| 13719 | |||
| 13720 |
1/2✓ Branch 0 taken 313344 times.
✗ Branch 1 not taken.
|
313344 | if(guyversion < 13) // April 2009 |
| 13721 | { | ||
| 13722 | ✗ | if(get_bit(deprecated_rules, qr_SLOWENEMYANIM_DEP)) | |
| 13723 | { | ||
| 13724 | ✗ | tempguy.frate *= 2; | |
| 13725 | ✗ | tempguy.e_frate *= 2; | |
| 13726 | ✗ | } | |
| 13727 | ✗ | } | |
| 13728 | |||
| 13729 |
1/2✓ Branch 0 taken 313344 times.
✗ Branch 1 not taken.
|
313344 | if(guyversion < 14) // May 1 2009 |
| 13730 | { | ||
| 13731 | ✗ | if(tempguy.anim==a2FRMSLOW) | |
| 13732 | { | ||
| 13733 | ✗ | tempguy.anim=a2FRM; | |
| 13734 | ✗ | tempguy.frate *= 2; | |
| 13735 | ✗ | } | |
| 13736 | |||
| 13737 | ✗ | if(tempguy.e_anim==a2FRMSLOW) | |
| 13738 | { | ||
| 13739 | ✗ | tempguy.e_anim=a2FRM; | |
| 13740 | ✗ | tempguy.e_frate *= 2; | |
| 13741 | ✗ | } | |
| 13742 | |||
| 13743 | ✗ | if(tempguy.anim==aFLIPSLOW) | |
| 13744 | { | ||
| 13745 | ✗ | tempguy.anim=aFLIP; | |
| 13746 | ✗ | tempguy.frate *= 2; | |
| 13747 | ✗ | } | |
| 13748 | |||
| 13749 | ✗ | if(tempguy.e_anim==aFLIPSLOW) | |
| 13750 | { | ||
| 13751 | ✗ | tempguy.e_anim=aFLIP; | |
| 13752 | ✗ | tempguy.e_frate *= 2; | |
| 13753 | ✗ | } | |
| 13754 | |||
| 13755 | ✗ | if(tempguy.anim == aNEWDWALK) tempguy.anim = a4FRM4DIR; | |
| 13756 | |||
| 13757 | ✗ | if(tempguy.e_anim == aNEWDWALK) tempguy.e_anim = a4FRM4DIR; | |
| 13758 | |||
| 13759 | ✗ | if(tempguy.anim == aNEWPOLV || tempguy.anim == a4FRM3TRAP) | |
| 13760 | { | ||
| 13761 | ✗ | tempguy.anim=a4FRM4DIR; | |
| 13762 | ✗ | tempguy.s_tile=(get_qr(qr_NEWENEMYTILES) ? tempguy.e_tile : tempguy.tile)+20; | |
| 13763 | ✗ | } | |
| 13764 | |||
| 13765 | ✗ | if(tempguy.e_anim == aNEWPOLV || tempguy.e_anim == a4FRM3TRAP) | |
| 13766 | { | ||
| 13767 | ✗ | tempguy.e_anim=a4FRM4DIR; | |
| 13768 | ✗ | tempguy.s_tile=(get_qr(qr_NEWENEMYTILES) ? tempguy.e_tile : tempguy.tile)+20; | |
| 13769 | ✗ | } | |
| 13770 | ✗ | } | |
| 13771 | |||
| 13772 |
1/2✓ Branch 0 taken 313344 times.
✗ Branch 1 not taken.
|
313344 | if(!p_igetw(&(tempguy.dp),f)) |
| 13773 | { | ||
| 13774 | ✗ | return qe_invalid; | |
| 13775 | } | ||
| 13776 | |||
| 13777 | //correction for guy fire | ||
| 13778 |
1/2✓ Branch 0 taken 313344 times.
✗ Branch 1 not taken.
|
313344 | if(guyversion < 6) |
| 13779 | { | ||
| 13780 | ✗ | if(i == gFIRE) | |
| 13781 | ✗ | tempguy.dp = 2; | |
| 13782 | ✗ | } | |
| 13783 | |||
| 13784 |
1/2✓ Branch 0 taken 313344 times.
✗ Branch 1 not taken.
|
313344 | if(!p_igetw(&(tempguy.wdp),f)) |
| 13785 | { | ||
| 13786 | ✗ | return qe_invalid; | |
| 13787 | } | ||
| 13788 | |||
| 13789 |
1/2✓ Branch 0 taken 313344 times.
✗ Branch 1 not taken.
|
313344 | if(!p_igetw(&(tempguy.weapon),f)) |
| 13790 | { | ||
| 13791 | ✗ | return qe_invalid; | |
| 13792 | } | ||
| 13793 | |||
| 13794 | //correction for bosses using triple, "rising" fireballs | ||
| 13795 |
1/2✓ Branch 0 taken 313344 times.
✗ Branch 1 not taken.
|
313344 | if(guyversion < 5) |
| 13796 | { | ||
| 13797 | ✗ | if(i == eLAQUAM || i == eRAQUAM || i == eGOHMA1 || i == eGOHMA2 || | |
| 13798 | ✗ | i == eGOHMA3 || i == eGOHMA4) | |
| 13799 | { | ||
| 13800 | ✗ | if(tempguy.weapon == ewFireball) | |
| 13801 | ✗ | tempguy.weapon = ewFireball2; | |
| 13802 | ✗ | } | |
| 13803 | ✗ | } | |
| 13804 | |||
| 13805 |
1/2✓ Branch 0 taken 313344 times.
✗ Branch 1 not taken.
|
313344 | if(!p_igetw(&(tempguy.rate),f)) |
| 13806 | { | ||
| 13807 | ✗ | return qe_invalid; | |
| 13808 | } | ||
| 13809 | |||
| 13810 |
1/2✓ Branch 0 taken 313344 times.
✗ Branch 1 not taken.
|
313344 | if(!p_igetw(&(tempguy.hrate),f)) |
| 13811 | { | ||
| 13812 | ✗ | return qe_invalid; | |
| 13813 | } | ||
| 13814 | |||
| 13815 |
1/2✓ Branch 0 taken 313344 times.
✗ Branch 1 not taken.
|
313344 | if(!p_igetw(&(tempguy.step),f)) |
| 13816 | { | ||
| 13817 | ✗ | return qe_invalid; | |
| 13818 | } | ||
| 13819 | |||
| 13820 | // HIGHLY UNORTHODOX UPDATING THING, part 2 | ||
| 13821 |
3/4✓ Branch 0 taken 2560 times.
✓ Branch 1 taken 310784 times.
✓ Branch 2 taken 2560 times.
✗ Branch 3 not taken.
|
313344 | if(fixpolsvoice && tempguy.family==eePOLSV) |
| 13822 | { | ||
| 13823 | ✗ | tempguy.step /= 2; | |
| 13824 | ✗ | } | |
| 13825 | |||
| 13826 |
1/2✓ Branch 0 taken 313344 times.
✗ Branch 1 not taken.
|
313344 | if(!p_igetw(&(tempguy.homing),f)) |
| 13827 | { | ||
| 13828 | ✗ | return qe_invalid; | |
| 13829 | } | ||
| 13830 | |||
| 13831 |
1/2✓ Branch 0 taken 313344 times.
✗ Branch 1 not taken.
|
313344 | if(!p_igetw(&(tempguy.grumble),f)) |
| 13832 | { | ||
| 13833 | ✗ | return qe_invalid; | |
| 13834 | } | ||
| 13835 | |||
| 13836 |
1/2✓ Branch 0 taken 313344 times.
✗ Branch 1 not taken.
|
313344 | if(!p_igetw(&(tempguy.item_set),f)) |
| 13837 | { | ||
| 13838 | ✗ | return qe_invalid; | |
| 13839 | } | ||
| 13840 | |||
| 13841 |
1/2✓ Branch 0 taken 313344 times.
✗ Branch 1 not taken.
|
313344 | if(guyversion>=22) // Version 22: Expand misc attributes to 32 bits |
| 13842 | { | ||
| 13843 |
1/2✓ Branch 0 taken 313344 times.
✗ Branch 1 not taken.
|
313344 | if(!p_igetl(&(tempguy.misc1),f)) |
| 13844 | { | ||
| 13845 | ✗ | return qe_invalid; | |
| 13846 | } | ||
| 13847 | |||
| 13848 |
1/2✓ Branch 0 taken 313344 times.
✗ Branch 1 not taken.
|
313344 | if(!p_igetl(&(tempguy.misc2),f)) |
| 13849 | { | ||
| 13850 | ✗ | return qe_invalid; | |
| 13851 | } | ||
| 13852 | |||
| 13853 |
1/2✓ Branch 0 taken 313344 times.
✗ Branch 1 not taken.
|
313344 | if(!p_igetl(&(tempguy.misc3),f)) |
| 13854 | { | ||
| 13855 | ✗ | return qe_invalid; | |
| 13856 | } | ||
| 13857 | |||
| 13858 |
1/2✓ Branch 0 taken 313344 times.
✗ Branch 1 not taken.
|
313344 | if(!p_igetl(&(tempguy.misc4),f)) |
| 13859 | { | ||
| 13860 | ✗ | return qe_invalid; | |
| 13861 | } | ||
| 13862 | |||
| 13863 |
1/2✓ Branch 0 taken 313344 times.
✗ Branch 1 not taken.
|
313344 | if(!p_igetl(&(tempguy.misc5),f)) |
| 13864 | { | ||
| 13865 | ✗ | return qe_invalid; | |
| 13866 | } | ||
| 13867 | |||
| 13868 |
1/2✓ Branch 0 taken 313344 times.
✗ Branch 1 not taken.
|
313344 | if(!p_igetl(&(tempguy.misc6),f)) |
| 13869 | { | ||
| 13870 | ✗ | return qe_invalid; | |
| 13871 | } | ||
| 13872 | |||
| 13873 |
1/2✓ Branch 0 taken 313344 times.
✗ Branch 1 not taken.
|
313344 | if(!p_igetl(&(tempguy.misc7),f)) |
| 13874 | { | ||
| 13875 | ✗ | return qe_invalid; | |
| 13876 | } | ||
| 13877 | |||
| 13878 |
1/2✓ Branch 0 taken 313344 times.
✗ Branch 1 not taken.
|
313344 | if(!p_igetl(&(tempguy.misc8),f)) |
| 13879 | { | ||
| 13880 | ✗ | return qe_invalid; | |
| 13881 | } | ||
| 13882 | |||
| 13883 |
1/2✓ Branch 0 taken 313344 times.
✗ Branch 1 not taken.
|
313344 | if(!p_igetl(&(tempguy.misc9),f)) |
| 13884 | { | ||
| 13885 | ✗ | return qe_invalid; | |
| 13886 | } | ||
| 13887 | |||
| 13888 |
1/2✓ Branch 0 taken 313344 times.
✗ Branch 1 not taken.
|
313344 | if(!p_igetl(&(tempguy.misc10),f)) |
| 13889 | { | ||
| 13890 | ✗ | return qe_invalid; | |
| 13891 | } | ||
| 13892 | 313344 | } | |
| 13893 | else | ||
| 13894 | { | ||
| 13895 | int16_t tempMisc; | ||
| 13896 | |||
| 13897 | ✗ | if(!p_igetw(&tempMisc,f)) | |
| 13898 | { | ||
| 13899 | ✗ | return qe_invalid; | |
| 13900 | } | ||
| 13901 | |||
| 13902 | ✗ | tempguy.misc1=tempMisc; | |
| 13903 | |||
| 13904 | ✗ | if(!p_igetw(&tempMisc,f)) | |
| 13905 | { | ||
| 13906 | ✗ | return qe_invalid; | |
| 13907 | } | ||
| 13908 | |||
| 13909 | ✗ | tempguy.misc2=tempMisc; | |
| 13910 | |||
| 13911 | ✗ | if(!p_igetw(&tempMisc,f)) | |
| 13912 | { | ||
| 13913 | ✗ | return qe_invalid; | |
| 13914 | } | ||
| 13915 | |||
| 13916 | ✗ | tempguy.misc3=tempMisc; | |
| 13917 | |||
| 13918 | ✗ | if(!p_igetw(&tempMisc,f)) | |
| 13919 | { | ||
| 13920 | ✗ | return qe_invalid; | |
| 13921 | } | ||
| 13922 | |||
| 13923 | ✗ | tempguy.misc4=tempMisc; | |
| 13924 | |||
| 13925 | ✗ | if(!p_igetw(&tempMisc,f)) | |
| 13926 | { | ||
| 13927 | ✗ | return qe_invalid; | |
| 13928 | } | ||
| 13929 | |||
| 13930 | ✗ | tempguy.misc5=tempMisc; | |
| 13931 | |||
| 13932 | ✗ | if(guyversion < 13) // April 2009 - a tiny Wizzrobe update | |
| 13933 | { | ||
| 13934 | ✗ | if(tempguy.family == eeWIZZ && !(tempguy.misc1)) | |
| 13935 | ✗ | tempguy.misc5 = 74; | |
| 13936 | ✗ | } | |
| 13937 | |||
| 13938 | ✗ | if(!p_igetw(&tempMisc,f)) | |
| 13939 | { | ||
| 13940 | ✗ | return qe_invalid; | |
| 13941 | } | ||
| 13942 | |||
| 13943 | ✗ | tempguy.misc6=tempMisc; | |
| 13944 | |||
| 13945 | ✗ | if(!p_igetw(&tempMisc,f)) | |
| 13946 | { | ||
| 13947 | ✗ | return qe_invalid; | |
| 13948 | } | ||
| 13949 | |||
| 13950 | ✗ | tempguy.misc7=tempMisc; | |
| 13951 | |||
| 13952 | ✗ | if(!p_igetw(&tempMisc,f)) | |
| 13953 | { | ||
| 13954 | ✗ | return qe_invalid; | |
| 13955 | } | ||
| 13956 | |||
| 13957 | ✗ | tempguy.misc8=tempMisc; | |
| 13958 | |||
| 13959 | ✗ | if(!p_igetw(&tempMisc,f)) | |
| 13960 | { | ||
| 13961 | ✗ | return qe_invalid; | |
| 13962 | } | ||
| 13963 | |||
| 13964 | ✗ | tempguy.misc9=tempMisc; | |
| 13965 | |||
| 13966 | ✗ | if(!p_igetw(&tempMisc,f)) | |
| 13967 | { | ||
| 13968 | ✗ | return qe_invalid; | |
| 13969 | } | ||
| 13970 | |||
| 13971 | ✗ | tempguy.misc10=tempMisc; | |
| 13972 | } | ||
| 13973 | |||
| 13974 |
1/2✓ Branch 0 taken 313344 times.
✗ Branch 1 not taken.
|
313344 | if(!p_igetw(&(tempguy.bgsfx),f)) |
| 13975 | { | ||
| 13976 | ✗ | return qe_invalid; | |
| 13977 | } | ||
| 13978 | |||
| 13979 |
1/2✓ Branch 0 taken 313344 times.
✗ Branch 1 not taken.
|
313344 | if(!p_igetw(&(tempguy.bosspal),f)) |
| 13980 | { | ||
| 13981 | ✗ | return qe_invalid; | |
| 13982 | } | ||
| 13983 | |||
| 13984 |
1/2✓ Branch 0 taken 313344 times.
✗ Branch 1 not taken.
|
313344 | if(!p_igetw(&(tempguy.extend),f)) |
| 13985 | { | ||
| 13986 | ✗ | return qe_invalid; | |
| 13987 | } | ||
| 13988 | |||
| 13989 | //! Enemy Defences | ||
| 13990 | |||
| 13991 | //If a 2.50 quest, use only the 2.5 defences. | ||
| 13992 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 313344 times.
|
313344 | if(guyversion >= 16 ) // November 2009 - Super Enemy Editor |
| 13993 | { | ||
| 13994 |
2/2✓ Branch 0 taken 5953536 times.
✓ Branch 1 taken 313344 times.
|
6266880 | for(int32_t j=0; j<edefLAST; j++) |
| 13995 | { | ||
| 13996 |
1/2✓ Branch 0 taken 5953536 times.
✗ Branch 1 not taken.
|
5953536 | if(!p_getc(&(tempguy.defense[j]),f)) |
| 13997 | { | ||
| 13998 | ✗ | return qe_invalid; | |
| 13999 | } | ||
| 14000 | 5953536 | } | |
| 14001 | //then copy the generic script defence to all the new script defences | ||
| 14002 | |||
| 14003 | 313344 | } | |
| 14004 | |||
| 14005 | |||
| 14006 | |||
| 14007 | |||
| 14008 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 313344 times.
|
313344 | if(guyversion >= 18) |
| 14009 | { | ||
| 14010 |
1/2✓ Branch 0 taken 313344 times.
✗ Branch 1 not taken.
|
313344 | if(!p_getc(&(tempguy.hitsfx),f)) |
| 14011 | { | ||
| 14012 | ✗ | return qe_invalid; | |
| 14013 | } | ||
| 14014 | |||
| 14015 |
1/2✓ Branch 0 taken 313344 times.
✗ Branch 1 not taken.
|
313344 | if(!p_getc(&(tempguy.deadsfx),f)) |
| 14016 | { | ||
| 14017 | ✗ | return qe_invalid; | |
| 14018 | } | ||
| 14019 | 313344 | } | |
| 14020 | |||
| 14021 |
1/2✓ Branch 0 taken 313344 times.
✗ Branch 1 not taken.
|
313344 | if(guyversion >= 22) |
| 14022 | { | ||
| 14023 |
1/2✓ Branch 0 taken 313344 times.
✗ Branch 1 not taken.
|
313344 | if(!p_igetl(&(tempguy.misc11),f)) |
| 14024 | { | ||
| 14025 | ✗ | return qe_invalid; | |
| 14026 | } | ||
| 14027 | |||
| 14028 |
1/2✓ Branch 0 taken 313344 times.
✗ Branch 1 not taken.
|
313344 | if(!p_igetl(&(tempguy.misc12),f)) |
| 14029 | { | ||
| 14030 | ✗ | return qe_invalid; | |
| 14031 | } | ||
| 14032 | 313344 | } | |
| 14033 | ✗ | else if(guyversion >= 19) | |
| 14034 | { | ||
| 14035 | int16_t tempMisc; | ||
| 14036 | |||
| 14037 | ✗ | if(!p_igetw(&tempMisc,f)) | |
| 14038 | { | ||
| 14039 | ✗ | return qe_invalid; | |
| 14040 | } | ||
| 14041 | |||
| 14042 | ✗ | tempguy.misc11=tempMisc; | |
| 14043 | |||
| 14044 | ✗ | if(!p_igetw(&tempMisc,f)) | |
| 14045 | { | ||
| 14046 | ✗ | return qe_invalid; | |
| 14047 | } | ||
| 14048 | |||
| 14049 | ✗ | tempguy.misc12=tempMisc; | |
| 14050 | ✗ | } | |
| 14051 | |||
| 14052 | //If a 2.54 or later quest, use all of the defences. | ||
| 14053 |
2/2✓ Branch 0 taken 96768 times.
✓ Branch 1 taken 216576 times.
|
313344 | if(guyversion > 24) // Add new guyversion conditional statement |
| 14054 | { | ||
| 14055 |
2/2✓ Branch 0 taken 4764672 times.
✓ Branch 1 taken 216576 times.
|
4981248 | for(int32_t j=edefLAST; j<edefLAST255; j++) |
| 14056 | { | ||
| 14057 |
1/2✓ Branch 0 taken 4764672 times.
✗ Branch 1 not taken.
|
4764672 | if(!p_getc(&(tempguy.defense[j]),f)) |
| 14058 | { | ||
| 14059 | ✗ | return qe_invalid; | |
| 14060 | } | ||
| 14061 | 4764672 | } | |
| 14062 | 216576 | } | |
| 14063 | |||
| 14064 |
2/2✓ Branch 0 taken 216576 times.
✓ Branch 1 taken 96768 times.
|
313344 | if(guyversion <= 24) // Port over generic script settings from old quests in the new editor. |
| 14065 | { | ||
| 14066 |
2/2✓ Branch 0 taken 967680 times.
✓ Branch 1 taken 96768 times.
|
1064448 | for(int32_t j=edefSCRIPT01; j<=edefSCRIPT10; j++) |
| 14067 | { | ||
| 14068 | 967680 | tempguy.defense[j] = tempguy.defense[edefSCRIPT] ; | |
| 14069 | 967680 | } | |
| 14070 | 96768 | } | |
| 14071 | |||
| 14072 | //tilewidth, tileheight, hitwidth, hitheight, hitzheight, hitxofs, hityofs, hitzofs | ||
| 14073 |
2/2✓ Branch 0 taken 96768 times.
✓ Branch 1 taken 216576 times.
|
313344 | if(guyversion > 25) |
| 14074 | { | ||
| 14075 |
1/2✓ Branch 0 taken 216576 times.
✗ Branch 1 not taken.
|
216576 | if(!p_igetl(&(tempguy.txsz),f)) |
| 14076 | { | ||
| 14077 | ✗ | return qe_invalid; | |
| 14078 | } | ||
| 14079 |
1/2✓ Branch 0 taken 216576 times.
✗ Branch 1 not taken.
|
216576 | if(!p_igetl(&(tempguy.tysz),f)) |
| 14080 | { | ||
| 14081 | ✗ | return qe_invalid; | |
| 14082 | } | ||
| 14083 |
1/2✓ Branch 0 taken 216576 times.
✗ Branch 1 not taken.
|
216576 | if(!p_igetl(&(tempguy.hxsz),f)) |
| 14084 | { | ||
| 14085 | ✗ | return qe_invalid; | |
| 14086 | } | ||
| 14087 |
1/2✓ Branch 0 taken 216576 times.
✗ Branch 1 not taken.
|
216576 | if(!p_igetl(&(tempguy.hysz),f)) |
| 14088 | { | ||
| 14089 | ✗ | return qe_invalid; | |
| 14090 | } | ||
| 14091 |
1/2✓ Branch 0 taken 216576 times.
✗ Branch 1 not taken.
|
216576 | if(!p_igetl(&(tempguy.hzsz),f)) |
| 14092 | { | ||
| 14093 | ✗ | return qe_invalid; | |
| 14094 | } | ||
| 14095 | /* Is it safe to read a fixed with getl, or do I need to typecast it? -Z | ||
| 14096 | |||
| 14097 | */ | ||
| 14098 | 216576 | } | |
| 14099 | //More Enemy Editor vars for 2.60 | ||
| 14100 |
2/2✓ Branch 0 taken 96768 times.
✓ Branch 1 taken 216576 times.
|
313344 | if(guyversion > 26) |
| 14101 | { | ||
| 14102 |
1/2✓ Branch 0 taken 216576 times.
✗ Branch 1 not taken.
|
216576 | if(!p_igetl(&(tempguy.hxofs),f)) |
| 14103 | { | ||
| 14104 | ✗ | return qe_invalid; | |
| 14105 | } | ||
| 14106 |
1/2✓ Branch 0 taken 216576 times.
✗ Branch 1 not taken.
|
216576 | if(!p_igetl(&(tempguy.hyofs),f)) |
| 14107 | { | ||
| 14108 | ✗ | return qe_invalid; | |
| 14109 | } | ||
| 14110 |
1/2✓ Branch 0 taken 216576 times.
✗ Branch 1 not taken.
|
216576 | if(!p_igetl(&(tempguy.xofs),f)) |
| 14111 | { | ||
| 14112 | ✗ | return qe_invalid; | |
| 14113 | } | ||
| 14114 |
1/2✓ Branch 0 taken 216576 times.
✗ Branch 1 not taken.
|
216576 | if(!p_igetl(&(tempguy.yofs),f)) |
| 14115 | { | ||
| 14116 | ✗ | return qe_invalid; | |
| 14117 | } | ||
| 14118 |
1/2✓ Branch 0 taken 216576 times.
✗ Branch 1 not taken.
|
216576 | if(!p_igetl(&(tempguy.zofs),f)) |
| 14119 | { | ||
| 14120 | ✗ | return qe_invalid; | |
| 14121 | } | ||
| 14122 | 216576 | } | |
| 14123 | |||
| 14124 |
2/2✓ Branch 0 taken 216576 times.
✓ Branch 1 taken 96768 times.
|
313344 | if(guyversion <= 27) // Port over generic script settings from old quests in the new editor. |
| 14125 | { | ||
| 14126 | 96768 | tempguy.wpnsprite = 0; | |
| 14127 | 96768 | } | |
| 14128 | |||
| 14129 |
2/2✓ Branch 0 taken 96768 times.
✓ Branch 1 taken 216576 times.
|
313344 | if(guyversion > 27) |
| 14130 | { | ||
| 14131 |
1/2✓ Branch 0 taken 216576 times.
✗ Branch 1 not taken.
|
216576 | if(!p_igetl(&(tempguy.wpnsprite),f)) |
| 14132 | { | ||
| 14133 | ✗ | return qe_invalid; | |
| 14134 | } | ||
| 14135 | 216576 | } | |
| 14136 |
2/2✓ Branch 0 taken 216576 times.
✓ Branch 1 taken 96768 times.
|
313344 | if(guyversion <= 28) // Port over generic script settings from old quests in the new editor. |
| 14137 | { | ||
| 14138 | 96768 | tempguy.SIZEflags = 0; | |
| 14139 | 96768 | } | |
| 14140 |
2/2✓ Branch 0 taken 96768 times.
✓ Branch 1 taken 216576 times.
|
313344 | if(guyversion > 28) |
| 14141 | { | ||
| 14142 |
1/2✓ Branch 0 taken 216576 times.
✗ Branch 1 not taken.
|
216576 | if(!p_igetl(&(tempguy.SIZEflags),f)) |
| 14143 | { | ||
| 14144 | ✗ | return qe_invalid; | |
| 14145 | } | ||
| 14146 | |||
| 14147 | 216576 | } | |
| 14148 |
2/2✓ Branch 0 taken 216576 times.
✓ Branch 1 taken 96768 times.
|
313344 | if(guyversion < 30) // Port over generic script settings from old quests in the new editor. |
| 14149 | { | ||
| 14150 | 96768 | tempguy.frozentile = 0; | |
| 14151 | 96768 | tempguy.frozencset = 0; | |
| 14152 | 96768 | tempguy.frozenclock = 0; | |
| 14153 |
2/2✓ Branch 0 taken 967680 times.
✓ Branch 1 taken 96768 times.
|
1064448 | for ( int32_t q = 0; q < 10; q++ ) tempguy.frozenmisc[q] = 0; |
| 14154 | 96768 | } | |
| 14155 |
2/2✓ Branch 0 taken 96768 times.
✓ Branch 1 taken 216576 times.
|
313344 | if(guyversion >= 30) |
| 14156 | { | ||
| 14157 |
1/2✓ Branch 0 taken 216576 times.
✗ Branch 1 not taken.
|
216576 | if(!p_igetl(&(tempguy.frozentile),f)) |
| 14158 | { | ||
| 14159 | ✗ | return qe_invalid; | |
| 14160 | } | ||
| 14161 |
1/2✓ Branch 0 taken 216576 times.
✗ Branch 1 not taken.
|
216576 | if(!p_igetl(&(tempguy.frozencset),f)) |
| 14162 | { | ||
| 14163 | ✗ | return qe_invalid; | |
| 14164 | } | ||
| 14165 |
1/2✓ Branch 0 taken 216576 times.
✗ Branch 1 not taken.
|
216576 | if(!p_igetl(&(tempguy.frozenclock),f)) |
| 14166 | { | ||
| 14167 | ✗ | return qe_invalid; | |
| 14168 | } | ||
| 14169 |
2/2✓ Branch 0 taken 2165760 times.
✓ Branch 1 taken 216576 times.
|
2382336 | for ( int32_t q = 0; q < 10; q++ ) { |
| 14170 |
1/2✓ Branch 0 taken 2165760 times.
✗ Branch 1 not taken.
|
2165760 | if(!p_igetw(&(tempguy.frozenmisc[q]),f)) |
| 14171 | { | ||
| 14172 | ✗ | return qe_invalid; | |
| 14173 | } | ||
| 14174 | 2165760 | } | |
| 14175 | |||
| 14176 | 216576 | } | |
| 14177 | |||
| 14178 |
2/2✓ Branch 0 taken 96768 times.
✓ Branch 1 taken 216576 times.
|
313344 | if(guyversion >= 34) |
| 14179 | { | ||
| 14180 |
1/2✓ Branch 0 taken 216576 times.
✗ Branch 1 not taken.
|
216576 | if(!p_igetw(&(tempguy.firesfx),f)) |
| 14181 | { | ||
| 14182 | ✗ | return qe_invalid; | |
| 14183 | } | ||
| 14184 |
1/2✓ Branch 0 taken 216576 times.
✗ Branch 1 not taken.
|
216576 | if(!p_igetl(&(tempguy.misc16),f)) |
| 14185 | { | ||
| 14186 | ✗ | return qe_invalid; | |
| 14187 | } | ||
| 14188 |
1/2✓ Branch 0 taken 216576 times.
✗ Branch 1 not taken.
|
216576 | if(!p_igetl(&(tempguy.misc17),f)) |
| 14189 | { | ||
| 14190 | ✗ | return qe_invalid; | |
| 14191 | } | ||
| 14192 |
1/2✓ Branch 0 taken 216576 times.
✗ Branch 1 not taken.
|
216576 | if(!p_igetl(&(tempguy.misc18),f)) |
| 14193 | { | ||
| 14194 | ✗ | return qe_invalid; | |
| 14195 | } | ||
| 14196 |
1/2✓ Branch 0 taken 216576 times.
✗ Branch 1 not taken.
|
216576 | if(!p_igetl(&(tempguy.misc19),f)) |
| 14197 | { | ||
| 14198 | ✗ | return qe_invalid; | |
| 14199 | } | ||
| 14200 |
1/2✓ Branch 0 taken 216576 times.
✗ Branch 1 not taken.
|
216576 | if(!p_igetl(&(tempguy.misc20),f)) |
| 14201 | { | ||
| 14202 | ✗ | return qe_invalid; | |
| 14203 | } | ||
| 14204 |
1/2✓ Branch 0 taken 216576 times.
✗ Branch 1 not taken.
|
216576 | if(!p_igetl(&(tempguy.misc21),f)) |
| 14205 | { | ||
| 14206 | ✗ | return qe_invalid; | |
| 14207 | } | ||
| 14208 |
1/2✓ Branch 0 taken 216576 times.
✗ Branch 1 not taken.
|
216576 | if(!p_igetl(&(tempguy.misc22),f)) |
| 14209 | { | ||
| 14210 | ✗ | return qe_invalid; | |
| 14211 | } | ||
| 14212 |
1/2✓ Branch 0 taken 216576 times.
✗ Branch 1 not taken.
|
216576 | if(!p_igetl(&(tempguy.misc23),f)) |
| 14213 | { | ||
| 14214 | ✗ | return qe_invalid; | |
| 14215 | } | ||
| 14216 |
1/2✓ Branch 0 taken 216576 times.
✗ Branch 1 not taken.
|
216576 | if(!p_igetl(&(tempguy.misc24),f)) |
| 14217 | { | ||
| 14218 | ✗ | return qe_invalid; | |
| 14219 | } | ||
| 14220 |
1/2✓ Branch 0 taken 216576 times.
✗ Branch 1 not taken.
|
216576 | if(!p_igetl(&(tempguy.misc25),f)) |
| 14221 | { | ||
| 14222 | ✗ | return qe_invalid; | |
| 14223 | } | ||
| 14224 |
1/2✓ Branch 0 taken 216576 times.
✗ Branch 1 not taken.
|
216576 | if(!p_igetl(&(tempguy.misc26),f)) |
| 14225 | { | ||
| 14226 | ✗ | return qe_invalid; | |
| 14227 | } | ||
| 14228 |
1/2✓ Branch 0 taken 216576 times.
✗ Branch 1 not taken.
|
216576 | if(!p_igetl(&(tempguy.misc27),f)) |
| 14229 | { | ||
| 14230 | ✗ | return qe_invalid; | |
| 14231 | } | ||
| 14232 |
1/2✓ Branch 0 taken 216576 times.
✗ Branch 1 not taken.
|
216576 | if(!p_igetl(&(tempguy.misc28),f)) |
| 14233 | { | ||
| 14234 | ✗ | return qe_invalid; | |
| 14235 | } | ||
| 14236 |
1/2✓ Branch 0 taken 216576 times.
✗ Branch 1 not taken.
|
216576 | if(!p_igetl(&(tempguy.misc29),f)) |
| 14237 | { | ||
| 14238 | ✗ | return qe_invalid; | |
| 14239 | } | ||
| 14240 |
1/2✓ Branch 0 taken 216576 times.
✗ Branch 1 not taken.
|
216576 | if(!p_igetl(&(tempguy.misc30),f)) |
| 14241 | { | ||
| 14242 | ✗ | return qe_invalid; | |
| 14243 | } | ||
| 14244 |
1/2✓ Branch 0 taken 216576 times.
✗ Branch 1 not taken.
|
216576 | if(!p_igetl(&(tempguy.misc31),f)) |
| 14245 | { | ||
| 14246 | ✗ | return qe_invalid; | |
| 14247 | } | ||
| 14248 |
1/2✓ Branch 0 taken 216576 times.
✗ Branch 1 not taken.
|
216576 | if(!p_igetl(&(tempguy.misc32),f)) |
| 14249 | { | ||
| 14250 | ✗ | return qe_invalid; | |
| 14251 | } | ||
| 14252 | |||
| 14253 |
2/2✓ Branch 0 taken 6930432 times.
✓ Branch 1 taken 216576 times.
|
7147008 | for ( int32_t q = 0; q < 32; q++ ) { |
| 14254 |
1/2✓ Branch 0 taken 6930432 times.
✗ Branch 1 not taken.
|
6930432 | if(!p_igetl(&(tempguy.movement[q]),f)) |
| 14255 | { | ||
| 14256 | ✗ | return qe_invalid; | |
| 14257 | } | ||
| 14258 | 6930432 | } | |
| 14259 |
2/2✓ Branch 0 taken 6930432 times.
✓ Branch 1 taken 216576 times.
|
7147008 | for ( int32_t q = 0; q < 32; q++ ) { |
| 14260 |
1/2✓ Branch 0 taken 6930432 times.
✗ Branch 1 not taken.
|
6930432 | if(!p_igetl(&(tempguy.new_weapon[q]),f)) |
| 14261 | { | ||
| 14262 | ✗ | return qe_invalid; | |
| 14263 | } | ||
| 14264 | 6930432 | } | |
| 14265 |
1/2✓ Branch 0 taken 216576 times.
✗ Branch 1 not taken.
|
216576 | if(!p_igetw(&(tempguy.script),f)) |
| 14266 | { | ||
| 14267 | ✗ | return qe_invalid; | |
| 14268 | } | ||
| 14269 | //al_trace("NPC Script ID is: %d\n",tempguy.script); | ||
| 14270 |
2/2✓ Branch 0 taken 1732608 times.
✓ Branch 1 taken 216576 times.
|
1949184 | for ( int32_t q = 0; q < 8; q++ ) |
| 14271 | { | ||
| 14272 |
1/2✓ Branch 0 taken 1732608 times.
✗ Branch 1 not taken.
|
1732608 | if(!p_igetl(&(tempguy.initD[q]),f)) |
| 14273 | { | ||
| 14274 | ✗ | return qe_invalid; | |
| 14275 | } | ||
| 14276 | 1732608 | } | |
| 14277 |
2/2✓ Branch 0 taken 433152 times.
✓ Branch 1 taken 216576 times.
|
649728 | for ( int32_t q = 0; q < 2; q++ ) |
| 14278 | { | ||
| 14279 |
1/2✓ Branch 0 taken 433152 times.
✗ Branch 1 not taken.
|
433152 | if(!p_igetl(&(tempguy.initA[q]),f)) |
| 14280 | { | ||
| 14281 | ✗ | return qe_invalid; | |
| 14282 | } | ||
| 14283 | 433152 | } | |
| 14284 | |||
| 14285 | 216576 | } | |
| 14286 | |||
| 14287 |
2/2✓ Branch 0 taken 96768 times.
✓ Branch 1 taken 216576 times.
|
313344 | if(guyversion >= 37) |
| 14288 | { | ||
| 14289 |
1/2✓ Branch 0 taken 216576 times.
✗ Branch 1 not taken.
|
216576 | if(!p_igetl(&(tempguy.editorflags),f)) |
| 14290 | { | ||
| 14291 | ✗ | return qe_invalid; | |
| 14292 | } | ||
| 14293 | 216576 | } | |
| 14294 |
2/2✓ Branch 0 taken 216576 times.
✓ Branch 1 taken 96768 times.
|
313344 | if ( guyversion < 37 ) { tempguy.editorflags = 0; } |
| 14295 |
2/2✓ Branch 0 taken 96768 times.
✓ Branch 1 taken 216576 times.
|
313344 | if(guyversion >= 38) |
| 14296 | { | ||
| 14297 |
1/2✓ Branch 0 taken 216576 times.
✗ Branch 1 not taken.
|
216576 | if(!p_igetl(&(tempguy.misc13),f)) |
| 14298 | { | ||
| 14299 | ✗ | return qe_invalid; | |
| 14300 | } | ||
| 14301 |
1/2✓ Branch 0 taken 216576 times.
✗ Branch 1 not taken.
|
216576 | if(!p_igetl(&(tempguy.misc14),f)) |
| 14302 | { | ||
| 14303 | ✗ | return qe_invalid; | |
| 14304 | } | ||
| 14305 |
1/2✓ Branch 0 taken 216576 times.
✗ Branch 1 not taken.
|
216576 | if(!p_igetl(&(tempguy.misc15),f)) |
| 14306 | { | ||
| 14307 | ✗ | return qe_invalid; | |
| 14308 | } | ||
| 14309 | |||
| 14310 | 216576 | } | |
| 14311 |
2/2✓ Branch 0 taken 216576 times.
✓ Branch 1 taken 96768 times.
|
313344 | if ( guyversion < 38 ) |
| 14312 | { | ||
| 14313 | 96768 | tempguy.misc13 = 0; | |
| 14314 | 96768 | tempguy.misc14 = 0; | |
| 14315 | 96768 | tempguy.misc15 = 0; | |
| 14316 | 96768 | } | |
| 14317 | |||
| 14318 |
2/2✓ Branch 0 taken 96768 times.
✓ Branch 1 taken 216576 times.
|
313344 | if ( guyversion >= 39 ) |
| 14319 | { | ||
| 14320 |
2/2✓ Branch 0 taken 1732608 times.
✓ Branch 1 taken 216576 times.
|
1949184 | for ( int32_t q = 0; q < 8; q++ ) |
| 14321 | { | ||
| 14322 |
2/2✓ Branch 0 taken 112619520 times.
✓ Branch 1 taken 1732608 times.
|
114352128 | for ( int32_t w = 0; w < 65; w++ ) |
| 14323 | { | ||
| 14324 |
1/2✓ Branch 0 taken 112619520 times.
✗ Branch 1 not taken.
|
112619520 | if(!p_getc(&(tempguy.initD_label[q][w]),f)) |
| 14325 | { | ||
| 14326 | ✗ | return qe_invalid; | |
| 14327 | } | ||
| 14328 | 112619520 | } | |
| 14329 |
2/2✓ Branch 0 taken 112619520 times.
✓ Branch 1 taken 1732608 times.
|
114352128 | for ( int32_t w = 0; w < 65; w++ ) |
| 14330 | { | ||
| 14331 |
1/2✓ Branch 0 taken 112619520 times.
✗ Branch 1 not taken.
|
112619520 | if(!p_getc(&(tempguy.weapon_initD_label[q][w]),f)) |
| 14332 | { | ||
| 14333 | ✗ | return qe_invalid; | |
| 14334 | } | ||
| 14335 | 112619520 | } | |
| 14336 | 1732608 | } | |
| 14337 | |||
| 14338 | |||
| 14339 | 216576 | } | |
| 14340 |
2/2✓ Branch 0 taken 216576 times.
✓ Branch 1 taken 96768 times.
|
313344 | if ( guyversion < 39 ) //apply old InitD strings to both |
| 14341 | { | ||
| 14342 |
2/2✓ Branch 0 taken 774144 times.
✓ Branch 1 taken 96768 times.
|
870912 | for ( int32_t q = 0; q < 8; q++ ) |
| 14343 | { | ||
| 14344 | 774144 | sprintf(tempguy.initD_label[q],"InitD[%d]",q); | |
| 14345 | 774144 | sprintf(tempguy.weapon_initD_label[q],"InitD[%d]",q); | |
| 14346 | 774144 | } | |
| 14347 | 96768 | } | |
| 14348 |
2/2✓ Branch 0 taken 96768 times.
✓ Branch 1 taken 216576 times.
|
313344 | if ( guyversion >= 40 ) |
| 14349 | { | ||
| 14350 |
1/2✓ Branch 0 taken 216576 times.
✗ Branch 1 not taken.
|
216576 | if(!p_igetw(&(tempguy.weaponscript),f)) |
| 14351 | { | ||
| 14352 | ✗ | return qe_invalid; | |
| 14353 | } | ||
| 14354 | 216576 | } | |
| 14355 |
2/2✓ Branch 0 taken 216576 times.
✓ Branch 1 taken 96768 times.
|
313344 | if ( guyversion < 40 ) |
| 14356 | { | ||
| 14357 | 96768 | tempguy.weaponscript = 0; | |
| 14358 | 96768 | } | |
| 14359 | //eweapon script InitD | ||
| 14360 |
2/2✓ Branch 0 taken 96768 times.
✓ Branch 1 taken 216576 times.
|
313344 | if ( guyversion >= 41 ) |
| 14361 | { | ||
| 14362 |
2/2✓ Branch 0 taken 1732608 times.
✓ Branch 1 taken 216576 times.
|
1949184 | for ( int32_t q = 0; q < 8; q++ ) |
| 14363 | { | ||
| 14364 |
1/2✓ Branch 0 taken 1732608 times.
✗ Branch 1 not taken.
|
1732608 | if(!p_igetl(&(tempguy.weap_initiald[q]),f)) |
| 14365 | { | ||
| 14366 | ✗ | return qe_invalid; | |
| 14367 | } | ||
| 14368 | 1732608 | } | |
| 14369 |
1/2✓ Branch 0 taken 216576 times.
✗ Branch 1 not taken.
|
216576 | if ( guy_cversion < 4 ) |
| 14370 | { | ||
| 14371 | ✗ | if ( tempguy.family == eeKEESE ) | |
| 14372 | { | ||
| 14373 | |||
| 14374 | ✗ | if ( !tempguy.misc1 ) | |
| 14375 | { | ||
| 14376 | ✗ | tempguy.misc16 = 120; | |
| 14377 | ✗ | tempguy.misc17 = 16; | |
| 14378 | |||
| 14379 | ✗ | } | |
| 14380 | ✗ | } | |
| 14381 | ✗ | if ( tempguy.family == eePEAHAT ) | |
| 14382 | { | ||
| 14383 | ✗ | tempguy.misc16 = 80; | |
| 14384 | ✗ | tempguy.misc17 = 16; | |
| 14385 | ✗ | } | |
| 14386 | |||
| 14387 | ✗ | if ( tempguy.family == eeGHINI ) | |
| 14388 | { | ||
| 14389 | ✗ | tempguy.misc16 = 120; | |
| 14390 | ✗ | tempguy.misc17 = 10; | |
| 14391 | ✗ | } | |
| 14392 | |||
| 14393 | ✗ | } | |
| 14394 | 216576 | } | |
| 14395 | |||
| 14396 | |||
| 14397 | |||
| 14398 | //default weapon sprites (quest version < 2.54) | ||
| 14399 | //port over old defaults -Z | ||
| 14400 |
2/2✓ Branch 0 taken 216576 times.
✓ Branch 1 taken 96768 times.
|
313344 | if(guyversion < 32) |
| 14401 | { | ||
| 14402 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 96768 times.
|
96768 | if ( tempguy.wpnsprite <= 0 ) |
| 14403 | { | ||
| 14404 |
16/20✗ Branch 0 not taken.
✓ Branch 1 taken 2720 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 81949 times.
✓ Branch 4 taken 762 times.
✓ Branch 5 taken 659 times.
✓ Branch 6 taken 1824 times.
✓ Branch 7 taken 1227 times.
✓ Branch 8 taken 2290 times.
✓ Branch 9 taken 195 times.
✓ Branch 10 taken 77 times.
✓ Branch 11 taken 423 times.
✓ Branch 12 taken 77 times.
✓ Branch 13 taken 865 times.
✓ Branch 14 taken 1715 times.
✓ Branch 15 taken 219 times.
✓ Branch 16 taken 311 times.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
✓ Branch 19 taken 1455 times.
|
96768 | switch(tempguy.weapon) |
| 14405 | { | ||
| 14406 | case wNone: | ||
| 14407 | 81949 | tempguy.wpnsprite = 0; break; | |
| 14408 | |||
| 14409 | case wSword: | ||
| 14410 | case wBeam: | ||
| 14411 | case wBrang: | ||
| 14412 | case wBomb: | ||
| 14413 | case wSBomb: | ||
| 14414 | case wLitBomb: | ||
| 14415 | case wLitSBomb: | ||
| 14416 | case wArrow: | ||
| 14417 | case wFire: | ||
| 14418 | case wWhistle: | ||
| 14419 | case wBait: | ||
| 14420 | case wWand: | ||
| 14421 | case wMagic: | ||
| 14422 | case wCatching: | ||
| 14423 | case wWind: | ||
| 14424 | case wRefMagic: | ||
| 14425 | case wRefFireball: | ||
| 14426 | case wRefRock: | ||
| 14427 | case wHammer: | ||
| 14428 | case wHookshot: | ||
| 14429 | case wHSHandle: | ||
| 14430 | case wHSChain: | ||
| 14431 | case wSSparkle: | ||
| 14432 | case wFSparkle: | ||
| 14433 | case wSmack: | ||
| 14434 | case wPhantom: | ||
| 14435 | case wCByrna: | ||
| 14436 | case wRefBeam: | ||
| 14437 | case wStomp: | ||
| 14438 | case lwMax: | ||
| 14439 | case wScript1: | ||
| 14440 | case wScript2: | ||
| 14441 | case wScript3: | ||
| 14442 | case wScript4: | ||
| 14443 | case wScript5: | ||
| 14444 | case wScript6: | ||
| 14445 | case wScript7: | ||
| 14446 | case wScript8: | ||
| 14447 | case wScript9: | ||
| 14448 | case wScript10: | ||
| 14449 | case wIce: | ||
| 14450 | //Cannot use any of these weapons yet. | ||
| 14451 | ✗ | tempguy.wpnsprite = -1; | |
| 14452 | ✗ | break; | |
| 14453 | |||
| 14454 | case wEnemyWeapons: | ||
| 14455 | 2720 | case ewFireball: tempguy.wpnsprite = 17; break; | |
| 14456 | |||
| 14457 | 762 | case ewArrow: tempguy.wpnsprite = 19; break; | |
| 14458 | 659 | case ewBrang: tempguy.wpnsprite = 4; break; | |
| 14459 | 1824 | case ewSword: tempguy.wpnsprite = 20; break; | |
| 14460 | 1227 | case ewRock: tempguy.wpnsprite = 18; break; | |
| 14461 | 2290 | case ewMagic: tempguy.wpnsprite = 21; break; | |
| 14462 | 195 | case ewBomb: tempguy.wpnsprite = 78; break; | |
| 14463 | 77 | case ewSBomb: tempguy.wpnsprite = 79; break; | |
| 14464 | 423 | case ewLitBomb: tempguy.wpnsprite = 76; break; | |
| 14465 | 77 | case ewLitSBomb: tempguy.wpnsprite = 77; break; | |
| 14466 | 865 | case ewFireTrail: tempguy.wpnsprite = 80; break; | |
| 14467 | 1715 | case ewFlame: tempguy.wpnsprite = 35; break; | |
| 14468 | 219 | case ewWind: tempguy.wpnsprite = 36; break; | |
| 14469 | 311 | case ewFlame2: tempguy.wpnsprite = 81; break; | |
| 14470 | ✗ | case ewFlame2Trail: tempguy.wpnsprite = 82; break; | |
| 14471 | ✗ | case ewIce: tempguy.wpnsprite = 83; break; | |
| 14472 | 1455 | case ewFireball2: tempguy.wpnsprite = 17; break; //fireball (rising) | |
| 14473 | |||
| 14474 | |||
| 14475 | ✗ | default: break; //No assign. | |
| 14476 | } | ||
| 14477 | 96768 | } | |
| 14478 | 96768 | } | |
| 14479 | |||
| 14480 | //default weapon fire sound (quest version < 2.54) | ||
| 14481 | //port over old defaults and zero new data. -Z | ||
| 14482 |
2/2✓ Branch 0 taken 216576 times.
✓ Branch 1 taken 96768 times.
|
313344 | if(guyversion < 34) |
| 14483 | { | ||
| 14484 |
2/2✓ Branch 0 taken 3096576 times.
✓ Branch 1 taken 96768 times.
|
3193344 | for ( int32_t q = 0; q < 32; q++ ) |
| 14485 | { | ||
| 14486 | 3096576 | tempguy.movement[q] = 0; | |
| 14487 | 3096576 | tempguy.new_weapon[q] = 0; | |
| 14488 | |||
| 14489 | 3096576 | } | |
| 14490 | |||
| 14491 | //NPC Script attributes. | ||
| 14492 | 96768 | tempguy.script = 0; //No scripted enemies existed. -Z | |
| 14493 |
2/2✓ Branch 0 taken 774144 times.
✓ Branch 1 taken 96768 times.
|
870912 | for ( int32_t q = 0; q < 8; q++ ) tempguy.initD[q] = 0; //Script Data |
| 14494 |
2/2✓ Branch 0 taken 193536 times.
✓ Branch 1 taken 96768 times.
|
290304 | for ( int32_t q = 0; q < 2; q++ ) tempguy.initA[q] = 0; //Script Data |
| 14495 | |||
| 14496 | 96768 | tempguy.misc16 = 0; | |
| 14497 | 96768 | tempguy.misc17 = 0; | |
| 14498 | 96768 | tempguy.misc18 = 0; | |
| 14499 | 96768 | tempguy.misc19 = 0; | |
| 14500 | 96768 | tempguy.misc20 = 0; | |
| 14501 | 96768 | tempguy.misc21 = 0; | |
| 14502 | 96768 | tempguy.misc22 = 0; | |
| 14503 | 96768 | tempguy.misc23 = 0; | |
| 14504 | 96768 | tempguy.misc24 = 0; | |
| 14505 | 96768 | tempguy.misc25 = 0; | |
| 14506 | 96768 | tempguy.misc26 = 0; | |
| 14507 | 96768 | tempguy.misc27 = 0; | |
| 14508 | 96768 | tempguy.misc28 = 0; | |
| 14509 | 96768 | tempguy.misc29 = 0; | |
| 14510 | 96768 | tempguy.misc30 = 0; | |
| 14511 | 96768 | tempguy.misc31 = 0; | |
| 14512 | 96768 | tempguy.misc32 = 0; | |
| 14513 | |||
| 14514 | //old default sounds | ||
| 14515 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 96768 times.
|
96768 | if ( tempguy.firesfx <= 0 ) |
| 14516 | { | ||
| 14517 |
16/20✗ Branch 0 not taken.
✓ Branch 1 taken 2720 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 81949 times.
✓ Branch 4 taken 762 times.
✓ Branch 5 taken 659 times.
✓ Branch 6 taken 1824 times.
✓ Branch 7 taken 1227 times.
✓ Branch 8 taken 2290 times.
✓ Branch 9 taken 195 times.
✓ Branch 10 taken 77 times.
✓ Branch 11 taken 423 times.
✓ Branch 12 taken 77 times.
✓ Branch 13 taken 865 times.
✓ Branch 14 taken 1715 times.
✓ Branch 15 taken 219 times.
✓ Branch 16 taken 311 times.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
✓ Branch 19 taken 1455 times.
|
96768 | switch(tempguy.weapon) |
| 14518 | { | ||
| 14519 | case wNone: | ||
| 14520 | 81949 | tempguy.firesfx = 0; break; | |
| 14521 | |||
| 14522 | case wSword: | ||
| 14523 | case wBeam: | ||
| 14524 | case wBrang: | ||
| 14525 | case wBomb: | ||
| 14526 | case wSBomb: | ||
| 14527 | case wLitBomb: | ||
| 14528 | case wLitSBomb: | ||
| 14529 | case wArrow: | ||
| 14530 | case wFire: | ||
| 14531 | case wWhistle: | ||
| 14532 | case wBait: | ||
| 14533 | case wWand: | ||
| 14534 | case wMagic: | ||
| 14535 | case wCatching: | ||
| 14536 | case wWind: | ||
| 14537 | case wRefMagic: | ||
| 14538 | case wRefFireball: | ||
| 14539 | case wRefRock: | ||
| 14540 | case wHammer: | ||
| 14541 | case wHookshot: | ||
| 14542 | case wHSHandle: | ||
| 14543 | case wHSChain: | ||
| 14544 | case wSSparkle: | ||
| 14545 | case wFSparkle: | ||
| 14546 | case wSmack: | ||
| 14547 | case wPhantom: | ||
| 14548 | case wCByrna: | ||
| 14549 | case wRefBeam: | ||
| 14550 | case wStomp: | ||
| 14551 | case lwMax: | ||
| 14552 | case wScript1: | ||
| 14553 | case wScript2: | ||
| 14554 | case wScript3: | ||
| 14555 | case wScript4: | ||
| 14556 | case wScript5: | ||
| 14557 | case wScript6: | ||
| 14558 | case wScript7: | ||
| 14559 | case wScript8: | ||
| 14560 | case wScript9: | ||
| 14561 | case wScript10: | ||
| 14562 | case wIce: | ||
| 14563 | //Cannot use any of these weapons yet. | ||
| 14564 | ✗ | tempguy.firesfx = -1; | |
| 14565 | ✗ | break; | |
| 14566 | |||
| 14567 | case wEnemyWeapons: | ||
| 14568 | 2720 | case ewFireball: tempguy.firesfx = 40; break; | |
| 14569 | |||
| 14570 | 762 | case ewArrow: tempguy.firesfx = 1; break; //Ghost.zh has 0? | |
| 14571 | 659 | case ewBrang: tempguy.firesfx = 4; break; //Ghost.zh has 0? | |
| 14572 | 1824 | case ewSword: tempguy.firesfx = 20; break; //Ghost.zh has 0? | |
| 14573 | 1227 | case ewRock: tempguy.firesfx = 51; break; | |
| 14574 | 2290 | case ewMagic: tempguy.firesfx = 32; break; | |
| 14575 | 195 | case ewBomb: tempguy.firesfx = 3; break; //Ghost.zh has 0? | |
| 14576 | 77 | case ewSBomb: tempguy.firesfx = 3; break; //Ghost.zh has 0? | |
| 14577 | 423 | case ewLitBomb: tempguy.firesfx = 21; break; //Ghost.zh has 0? | |
| 14578 | 77 | case ewLitSBomb: tempguy.firesfx = 21; break; //Ghost.zh has 0? | |
| 14579 | 865 | case ewFireTrail: tempguy.firesfx = 13; break; | |
| 14580 | 1715 | case ewFlame: tempguy.firesfx = 13; break; | |
| 14581 | 219 | case ewWind: tempguy.firesfx = 32; break; | |
| 14582 | 311 | case ewFlame2: tempguy.firesfx = 13; break; | |
| 14583 | ✗ | case ewFlame2Trail: tempguy.firesfx = 13; break; | |
| 14584 | ✗ | case ewIce: tempguy.firesfx = 44; break; | |
| 14585 | 1455 | case ewFireball2: tempguy.firesfx = 40; break; //fireball (rising) | |
| 14586 | |||
| 14587 | //what about special attacks (e.g. summoning == 56) | ||
| 14588 | ✗ | default: break; //No assign. | |
| 14589 | } | ||
| 14590 | 96768 | } | |
| 14591 | 96768 | } | |
| 14592 | |||
| 14593 | //Port hardcoded hit sound to the enemy hitsfx defaults for older quests. | ||
| 14594 |
4/6✓ Branch 0 taken 216576 times.
✓ Branch 1 taken 96768 times.
✓ Branch 2 taken 216576 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 216576 times.
|
313344 | if(Header->zelda_version <= 0x250 || ( Header->zelda_version > 0x250 && guyversion < 35 )) |
| 14595 | { | ||
| 14596 |
2/2✓ Branch 0 taken 13335 times.
✓ Branch 1 taken 83433 times.
|
96768 | if ( tempguy.hitsfx == 0 ) tempguy.hitsfx = 11; |
| 14597 | 96768 | } | |
| 14598 | //Keese and bat halt rates. | ||
| 14599 |
3/4✓ Branch 0 taken 96768 times.
✓ Branch 1 taken 216576 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 96768 times.
|
313344 | if ( guyversion < 42 && guy_cversion < 4 ) |
| 14600 | { | ||
| 14601 | |||
| 14602 |
2/2✓ Branch 0 taken 95530 times.
✓ Branch 1 taken 1238 times.
|
96768 | if ( tempguy.family == eeKEESE ) |
| 14603 | { | ||
| 14604 | |||
| 14605 |
2/2✓ Branch 0 taken 349 times.
✓ Branch 1 taken 889 times.
|
1238 | if ( !tempguy.misc1 ) |
| 14606 | { | ||
| 14607 | 889 | tempguy.misc16 = 120; | |
| 14608 | 889 | tempguy.misc17 = 16; | |
| 14609 | |||
| 14610 | 889 | } | |
| 14611 | 1238 | } | |
| 14612 |
2/2✓ Branch 0 taken 96325 times.
✓ Branch 1 taken 443 times.
|
96768 | if ( tempguy.family == eePEAHAT ) |
| 14613 | { | ||
| 14614 | 443 | tempguy.misc16 = 80; | |
| 14615 | 443 | tempguy.misc17 = 16; | |
| 14616 | 443 | } | |
| 14617 |
2/2✓ Branch 0 taken 96579 times.
✓ Branch 1 taken 189 times.
|
96768 | if ( tempguy.family == eeGHINI ) |
| 14618 | { | ||
| 14619 | 189 | tempguy.misc16 = 120; | |
| 14620 | 189 | tempguy.misc17 = 10; | |
| 14621 | 189 | } | |
| 14622 | |||
| 14623 | |||
| 14624 | 96768 | } | |
| 14625 | |||
| 14626 | |||
| 14627 | //miscellaneous other corrections | ||
| 14628 | //fix the mirror wizzrobe -DD | ||
| 14629 |
1/2✓ Branch 0 taken 313344 times.
✗ Branch 1 not taken.
|
313344 | if(guyversion < 7) |
| 14630 | { | ||
| 14631 | ✗ | if(i == eMWIZ) | |
| 14632 | { | ||
| 14633 | ✗ | tempguy.misc2 = 0; | |
| 14634 | ✗ | tempguy.misc4 = 1; | |
| 14635 | ✗ | } | |
| 14636 | ✗ | } | |
| 14637 | |||
| 14638 |
1/2✓ Branch 0 taken 313344 times.
✗ Branch 1 not taken.
|
313344 | if(guyversion < 8) |
| 14639 | { | ||
| 14640 | ✗ | if(i == eGLEEOK1 || i == eGLEEOK2 || i == eGLEEOK3 || i == eGLEEOK4 || i == eGLEEOK1F || i == eGLEEOK2F || i == eGLEEOK3F || i == eGLEEOK4F) | |
| 14641 | { | ||
| 14642 | // Some of these are deliberately different to NewDefault/defdata.cpp, by the way. -L | ||
| 14643 | ✗ | tempguy.misc5 = 4; //neck length in segments | |
| 14644 | ✗ | tempguy.misc6 = 8; //neck offset from first body tile | |
| 14645 | ✗ | tempguy.misc7 = 40; //offset for each subsequent neck tile from the first neck tile | |
| 14646 | ✗ | tempguy.misc8 = 168; //head offset from first body tile | |
| 14647 | ✗ | tempguy.misc9 = 228; //flying head offset from first body tile | |
| 14648 | |||
| 14649 | ✗ | if(i == eGLEEOK1F || i == eGLEEOK2F || i == eGLEEOK3F || i == eGLEEOK4F) | |
| 14650 | { | ||
| 14651 | ✗ | tempguy.misc6 += 10; //neck offset from first body tile | |
| 14652 | ✗ | tempguy.misc8 -= 12; //head offset from first body tile | |
| 14653 | ✗ | } | |
| 14654 | ✗ | } | |
| 14655 | ✗ | } | |
| 14656 | |||
| 14657 |
1/2✓ Branch 0 taken 313344 times.
✗ Branch 1 not taken.
|
313344 | if(guyversion < 10) // December 2007 - Dodongo CSet fix |
| 14658 | { | ||
| 14659 | ✗ | if(get_bit(deprecated_rules,46) && tempguy.family==eeDONGO && tempguy.misc1==0) | |
| 14660 | ✗ | tempguy.bosspal = spDIG; | |
| 14661 | ✗ | } | |
| 14662 | |||
| 14663 |
1/2✓ Branch 0 taken 313344 times.
✗ Branch 1 not taken.
|
313344 | if(guyversion < 11) // December 2007 - Spinning Tile fix |
| 14664 | { | ||
| 14665 | ✗ | if(tempguy.family==eeSPINTILE) | |
| 14666 | { | ||
| 14667 | ✗ | tempguy.flags |= guy_superman; | |
| 14668 | ✗ | tempguy.item_set = 0; // Don't drop items | |
| 14669 | ✗ | tempguy.step = 300; | |
| 14670 | ✗ | } | |
| 14671 | ✗ | } | |
| 14672 | |||
| 14673 |
1/2✓ Branch 0 taken 313344 times.
✗ Branch 1 not taken.
|
313344 | if(guyversion < 12) // October 2008 - Flashing Bubble, Rope 2, and Ghini 2 fix |
| 14674 | { | ||
| 14675 | ✗ | if(get_bit(deprecated_rules, qr_NOROPE2FLASH_DEP)) | |
| 14676 | { | ||
| 14677 | ✗ | if(tempguy.family==eeROPE) | |
| 14678 | { | ||
| 14679 | ✗ | tempguy.flags2 &= ~guy_flashing; | |
| 14680 | ✗ | } | |
| 14681 | ✗ | } | |
| 14682 | |||
| 14683 | ✗ | if(get_bit(deprecated_rules, qr_NOBUBBLEFLASH_DEP)) | |
| 14684 | { | ||
| 14685 | ✗ | if(tempguy.family==eeBUBBLE) | |
| 14686 | { | ||
| 14687 | ✗ | tempguy.flags2 &= ~guy_flashing; | |
| 14688 | ✗ | } | |
| 14689 | ✗ | } | |
| 14690 | |||
| 14691 | ✗ | if((tempguy.family==eeGHINI)&&(tempguy.misc1)) | |
| 14692 | { | ||
| 14693 | ✗ | if(get_bit(deprecated_rules, qr_GHINI2BLINK_DEP)) | |
| 14694 | { | ||
| 14695 | ✗ | tempguy.flags2 |= guy_blinking; | |
| 14696 | ✗ | } | |
| 14697 | |||
| 14698 | ✗ | if(get_bit(deprecated_rules, qr_PHANTOMGHINI2_DEP)) | |
| 14699 | { | ||
| 14700 | ✗ | tempguy.flags2 |= guy_transparent; | |
| 14701 | ✗ | } | |
| 14702 | ✗ | } | |
| 14703 | ✗ | } | |
| 14704 | |||
| 14705 |
1/2✓ Branch 0 taken 313344 times.
✗ Branch 1 not taken.
|
313344 | if(guyversion < 15) // July 2009 - Guy Fire and Fairy fix |
| 14706 | { | ||
| 14707 | ✗ | if(i==gFIRE) | |
| 14708 | { | ||
| 14709 | ✗ | tempguy.e_anim = aFLIP; | |
| 14710 | ✗ | tempguy.e_frate = 24; | |
| 14711 | ✗ | } | |
| 14712 | |||
| 14713 | ✗ | if(i==gFAIRY) | |
| 14714 | { | ||
| 14715 | ✗ | tempguy.e_anim = a2FRM; | |
| 14716 | ✗ | tempguy.e_frate = 16; | |
| 14717 | ✗ | } | |
| 14718 | ✗ | } | |
| 14719 | |||
| 14720 |
1/2✓ Branch 0 taken 313344 times.
✗ Branch 1 not taken.
|
313344 | if(guyversion < 16) // November 2009 - Super Enemy Editor part 1 |
| 14721 | { | ||
| 14722 | ✗ | if(i==0) Z_message("Updating guys to version 16...\n"); | |
| 14723 | |||
| 14724 | ✗ | update_guy_1(&tempguy); | |
| 14725 | |||
| 14726 | ✗ | if(i==eMPOLSV) | |
| 14727 | { | ||
| 14728 | ✗ | tempguy.defense[edefARROW] = edCHINK; | |
| 14729 | ✗ | tempguy.defense[edefMAGIC] = ed1HKO; | |
| 14730 | ✗ | tempguy.defense[edefREFMAGIC] = ed1HKO; | |
| 14731 | ✗ | } | |
| 14732 | ✗ | } | |
| 14733 | |||
| 14734 |
1/2✓ Branch 0 taken 313344 times.
✗ Branch 1 not taken.
|
313344 | if(guyversion < 17) // December 2009 |
| 14735 | { | ||
| 14736 | ✗ | if(tempguy.family==eePROJECTILE) | |
| 14737 | { | ||
| 14738 | ✗ | tempguy.misc1 = 0; | |
| 14739 | ✗ | } | |
| 14740 | ✗ | } | |
| 14741 | |||
| 14742 |
1/2✓ Branch 0 taken 313344 times.
✗ Branch 1 not taken.
|
313344 | if(guyversion < 18) // January 2010 |
| 14743 | { | ||
| 14744 | ✗ | bool boss = (tempguy.family == eeAQUA || tempguy.family==eeDONGO || tempguy.family == eeMANHAN || tempguy.family == eeGHOMA || tempguy.family==eeDIG | |
| 14745 | ✗ | || tempguy.family == eeGLEEOK || tempguy.family==eePATRA || tempguy.family == eeGANON || tempguy.family==eeMOLD); | |
| 14746 | |||
| 14747 | ✗ | tempguy.hitsfx = (boss && tempguy.family != eeMOLD && tempguy.family != eeDONGO && tempguy.family != eeDIG) ? WAV_GASP : 0; | |
| 14748 | ✗ | tempguy.deadsfx = (boss && (tempguy.family != eeDIG || tempguy.misc10 == 0)) ? WAV_GASP : WAV_EDEAD; | |
| 14749 | |||
| 14750 | ✗ | if(tempguy.family == eeAQUA) | |
| 14751 | ✗ | for(int32_t j=0; j<edefLAST; j++) tempguy.defense[j] = default_guys[eRAQUAM].defense[j]; | |
| 14752 | ✗ | else if(tempguy.family == eeMANHAN) | |
| 14753 | ✗ | for(int32_t j=0; j<edefLAST; j++) tempguy.defense[j] = default_guys[eMANHAN].defense[j]; | |
| 14754 | ✗ | else if(tempguy.family==eePATRA) | |
| 14755 | ✗ | for(int32_t j=0; j<edefLAST; j++) tempguy.defense[j] = default_guys[eGLEEOK1].defense[j]; | |
| 14756 | ✗ | else if(tempguy.family==eeGHOMA) | |
| 14757 | { | ||
| 14758 | ✗ | for(int32_t j=0; j<edefLAST; j++) | |
| 14759 | ✗ | tempguy.defense[j] = default_guys[eGOHMA1].defense[j]; | |
| 14760 | |||
| 14761 | ✗ | tempguy.defense[edefARROW] = ((tempguy.misc1==3) ? edCHINKL8 : (tempguy.misc1==2) ? edCHINKL4 : 0); | |
| 14762 | |||
| 14763 | ✗ | if(tempguy.misc1==3 && !tempguy.weapon) tempguy.weapon = ewFlame; | |
| 14764 | |||
| 14765 | ✗ | tempguy.misc1--; | |
| 14766 | ✗ | } | |
| 14767 | ✗ | else if(tempguy.family == eeGLEEOK) | |
| 14768 | { | ||
| 14769 | ✗ | for(int32_t j=0; j<edefLAST; j++) | |
| 14770 | ✗ | tempguy.defense[j] = default_guys[eGLEEOK1].defense[j]; | |
| 14771 | |||
| 14772 | ✗ | if(tempguy.misc3==1 && !tempguy.weapon) tempguy.weapon = ewFlame; | |
| 14773 | ✗ | } | |
| 14774 | ✗ | else if(tempguy.family == eeARMOS) | |
| 14775 | { | ||
| 14776 | ✗ | tempguy.family=eeWALK; | |
| 14777 | ✗ | tempguy.hrate = 0; | |
| 14778 | ✗ | tempguy.misc10 = tempguy.misc1; | |
| 14779 | ✗ | tempguy.misc1 = tempguy.misc2 = tempguy.misc3 = tempguy.misc4 = tempguy.misc5 = tempguy.misc6 = tempguy.misc7 = tempguy.misc8 = 0; | |
| 14780 | ✗ | tempguy.misc9 = e9tARMOS; | |
| 14781 | ✗ | } | |
| 14782 | ✗ | else if(tempguy.family == eeGHINI && !tempguy.misc1) | |
| 14783 | { | ||
| 14784 | ✗ | tempguy.family=eeWALK; | |
| 14785 | ✗ | tempguy.hrate = 0; | |
| 14786 | ✗ | tempguy.misc1 = tempguy.misc2 = tempguy.misc3 = tempguy.misc4 = tempguy.misc5 = tempguy.misc6 = | |
| 14787 | ✗ | tempguy.misc7 = tempguy.misc8 = tempguy.misc9 = tempguy.misc10 = 0; | |
| 14788 | ✗ | } | |
| 14789 | |||
| 14790 | // Spawn animation flags | ||
| 14791 | ✗ | if(tempguy.family == eeWALK && (tempguy.flags2&cmbflag_armos || tempguy.flags2&cmbflag_ghini)) | |
| 14792 | ✗ | tempguy.flags |= guy_fadeflicker; | |
| 14793 | else | ||
| 14794 | ✗ | tempguy.flags &= 0x0F00000F; // Get rid of the unused flags! | |
| 14795 | ✗ | } | |
| 14796 | |||
| 14797 |
1/2✓ Branch 0 taken 313344 times.
✗ Branch 1 not taken.
|
313344 | if(guyversion < 20) // April 2010 |
| 14798 | { | ||
| 14799 | ✗ | if(tempguy.family == eeTRAP) | |
| 14800 | { | ||
| 14801 | ✗ | tempguy.misc2 = tempguy.misc10; | |
| 14802 | |||
| 14803 | ✗ | if(tempguy.misc10>=1) | |
| 14804 | { | ||
| 14805 | ✗ | tempguy.misc1++; | |
| 14806 | ✗ | } | |
| 14807 | |||
| 14808 | ✗ | tempguy.misc10 = 0; | |
| 14809 | ✗ | } | |
| 14810 | |||
| 14811 | // Bomb Blast fix | ||
| 14812 | ✗ | if(tempguy.weapon==ewBomb && tempguy.family!=eeROPE && (tempguy.family!=eeWALK || tempguy.misc2 != e2tBOMBCHU)) | |
| 14813 | ✗ | tempguy.weapon = ewLitBomb; | |
| 14814 | ✗ | else if(tempguy.weapon==ewSBomb && tempguy.family!=eeROPE && (tempguy.family!=eeWALK || tempguy.misc2 != e2tBOMBCHU)) | |
| 14815 | ✗ | tempguy.weapon = ewLitSBomb; | |
| 14816 | ✗ | } | |
| 14817 | |||
| 14818 |
1/2✓ Branch 0 taken 313344 times.
✗ Branch 1 not taken.
|
313344 | if(guyversion < 21) // September 2011 |
| 14819 | { | ||
| 14820 | ✗ | if(tempguy.family == eeKEESE || tempguy.family == eeKEESETRIB) | |
| 14821 | { | ||
| 14822 | ✗ | if(tempguy.family == eeKEESETRIB) | |
| 14823 | { | ||
| 14824 | ✗ | tempguy.family = eeKEESE; | |
| 14825 | ✗ | tempguy.misc2 = e2tKEESETRIB; | |
| 14826 | ✗ | tempguy.misc1 = 0; | |
| 14827 | ✗ | } | |
| 14828 | |||
| 14829 | ✗ | tempguy.rate = 2; | |
| 14830 | ✗ | tempguy.hrate = 8; | |
| 14831 | ✗ | tempguy.homing = 0; | |
| 14832 | ✗ | tempguy.step= (tempguy.family == eeKEESE && tempguy.misc1 ? 100:62); | |
| 14833 | ✗ | } | |
| 14834 | ✗ | else if(tempguy.family == eePEAHAT || tempguy.family==eePATRA) | |
| 14835 | { | ||
| 14836 | ✗ | if(tempguy.family == eePEAHAT) | |
| 14837 | { | ||
| 14838 | ✗ | tempguy.rate = 4; | |
| 14839 | ✗ | tempguy.step = 62; | |
| 14840 | ✗ | } | |
| 14841 | else | ||
| 14842 | ✗ | tempguy.step = 25; | |
| 14843 | |||
| 14844 | ✗ | tempguy.hrate = 8; | |
| 14845 | ✗ | tempguy.homing = 0; | |
| 14846 | ✗ | } | |
| 14847 | ✗ | else if(tempguy.family == eeDIG || tempguy.family == eeMANHAN) | |
| 14848 | { | ||
| 14849 | ✗ | if(tempguy.family == eeMANHAN) | |
| 14850 | ✗ | tempguy.step=50; | |
| 14851 | |||
| 14852 | ✗ | tempguy.hrate = 16; | |
| 14853 | ✗ | tempguy.homing = 0; | |
| 14854 | ✗ | } | |
| 14855 | ✗ | else if(tempguy.family == eeGLEEOK) | |
| 14856 | { | ||
| 14857 | ✗ | tempguy.rate = 2; | |
| 14858 | ✗ | tempguy.homing = 0; | |
| 14859 | ✗ | tempguy.hrate = 9; | |
| 14860 | ✗ | tempguy.step=89; | |
| 14861 | ✗ | } | |
| 14862 | ✗ | else if(tempguy.family == eeGHINI) | |
| 14863 | { | ||
| 14864 | ✗ | tempguy.rate = 4; | |
| 14865 | ✗ | tempguy.hrate = 12; | |
| 14866 | ✗ | tempguy.step=62; | |
| 14867 | ✗ | tempguy.homing = 0; | |
| 14868 | ✗ | } | |
| 14869 | |||
| 14870 | // Bigdig random rate fix | ||
| 14871 | ✗ | if(tempguy.family==eeDIG && tempguy.misc10==1) | |
| 14872 | { | ||
| 14873 | ✗ | tempguy.rate = 2; | |
| 14874 | ✗ | } | |
| 14875 | ✗ | } | |
| 14876 | |||
| 14877 |
1/2✓ Branch 0 taken 313344 times.
✗ Branch 1 not taken.
|
313344 | if(guyversion < 24) // November 2012 |
| 14878 | { | ||
| 14879 | ✗ | if(tempguy.family==eeLANM) | |
| 14880 | ✗ | tempguy.misc3 = 1; | |
| 14881 | ✗ | else if(tempguy.family==eeMOLD) | |
| 14882 | ✗ | tempguy.misc2 = 0; | |
| 14883 | ✗ | } | |
| 14884 | |||
| 14885 |
2/2✓ Branch 0 taken 216576 times.
✓ Branch 1 taken 96768 times.
|
313344 | if(guyversion < 33) //Whistle defence did not exist before this version of 2.54. -Z |
| 14886 | { | ||
| 14887 |
2/2✓ Branch 0 taken 1339 times.
✓ Branch 1 taken 95429 times.
|
96768 | if(tempguy.family!=eeDIG) |
| 14888 | { | ||
| 14889 | 95429 | tempguy.defense[edefWhistle] = edIGNORE; //Might need to be ignore, universally. | |
| 14890 | 95429 | } | |
| 14891 | |||
| 14892 | 96768 | } | |
| 14893 | // does not seem to solve the issue! | ||
| 14894 |
1/2✓ Branch 0 taken 313344 times.
✗ Branch 1 not taken.
|
313344 | if ( Header->zelda_version <= 0x210 ) |
| 14895 | { | ||
| 14896 | ✗ | al_trace("Detected version %d for dodongo patch.\n",Header->zelda_version); | |
| 14897 | ✗ | if ( tempguy.family == eeDONGO ) | |
| 14898 | { | ||
| 14899 | ✗ | tempguy.deadsfx = 15; //In 2.10 and earlier, Dodongos used this as their death sound. | |
| 14900 | ✗ | } | |
| 14901 | ✗ | } | |
| 14902 | |||
| 14903 |
2/2✓ Branch 0 taken 216576 times.
✓ Branch 1 taken 96768 times.
|
313344 | if(guyversion >= 42) |
| 14904 | { | ||
| 14905 |
2/2✓ Branch 0 taken 214016 times.
✓ Branch 1 taken 2560 times.
|
216576 | if(guyversion >= 47) |
| 14906 | { | ||
| 14907 |
1/2✓ Branch 0 taken 214016 times.
✗ Branch 1 not taken.
|
214016 | if(!p_igetl(&(tempguy.moveflags),f)) |
| 14908 | { | ||
| 14909 | ✗ | return qe_invalid; | |
| 14910 | } | ||
| 14911 | 214016 | } | |
| 14912 | else | ||
| 14913 | { | ||
| 14914 | byte fl; | ||
| 14915 |
1/2✓ Branch 0 taken 2560 times.
✗ Branch 1 not taken.
|
2560 | if(!p_getc(&fl,f)) |
| 14916 | { | ||
| 14917 | ✗ | return qe_invalid; | |
| 14918 | } | ||
| 14919 | 2560 | tempguy.moveflags = fl; | |
| 14920 | } | ||
| 14921 | 216576 | } | |
| 14922 | else | ||
| 14923 | { | ||
| 14924 |
7/8✓ Branch 0 taken 2771 times.
✓ Branch 1 taken 76150 times.
✓ Branch 2 taken 2607 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 922 times.
✓ Branch 5 taken 611 times.
✓ Branch 6 taken 475 times.
✓ Branch 7 taken 13232 times.
|
96768 | switch(tempguy.family) |
| 14925 | { | ||
| 14926 | //No gravity; floats over pits | ||
| 14927 | case eeTEK: case eePEAHAT: case eeROCK: case eeTRAP: | ||
| 14928 | case eePROJECTILE: case eeSPINTILE: case eeKEESE: case eeFIRE: | ||
| 14929 | //Special (bosses, etc) | ||
| 14930 | case eeFAIRY: case eeGUY: case eeNONE: case eeZORA: | ||
| 14931 | case eeAQUA: case eeDIG: case eeGHOMA: case eeGANON: | ||
| 14932 | case eePATRA: case eeGLEEOK: case eeMOLD: case eeMANHAN: | ||
| 14933 | 76150 | tempguy.moveflags = FLAG_CAN_PITWALK; | |
| 14934 | 76150 | break; | |
| 14935 | //No gravity, but falls in pits | ||
| 14936 | case eeLEV: | ||
| 14937 | 922 | tempguy.moveflags = FLAG_CAN_PITFALL; | |
| 14938 | 922 | break; | |
| 14939 | //Bosses that respect pits | ||
| 14940 | case eeDONGO: | ||
| 14941 | 611 | tempguy.moveflags = FLAG_OBEYS_GRAV; | |
| 14942 | 611 | break; | |
| 14943 | case eeLANM: | ||
| 14944 | 475 | tempguy.moveflags = 0; | |
| 14945 | 475 | break; | |
| 14946 | //Gravity, floats over pits | ||
| 14947 | case eeWIZZ: case eeWALLM: case eeGHINI: | ||
| 14948 | 2607 | tempguy.moveflags = FLAG_OBEYS_GRAV | FLAG_CAN_PITWALK; | |
| 14949 | 2607 | break; | |
| 14950 | //Gravity and falls in pits | ||
| 14951 | case eeWALK: | ||
| 14952 |
4/4✓ Branch 0 taken 12569 times.
✓ Branch 1 taken 663 times.
✓ Branch 2 taken 508 times.
✓ Branch 3 taken 12061 times.
|
13232 | if (tempguy.misc9==e9tPOLSVOICE||tempguy.misc9==e9tVIRE) |
| 14953 | 1171 | break; | |
| 14954 | [[fallthrough]]; | ||
| 14955 | case eeOTHER: | ||
| 14956 | case eeSCRIPT01: case eeSCRIPT02: case eeSCRIPT03: case eeSCRIPT04: case eeSCRIPT05: | ||
| 14957 | case eeSCRIPT06: case eeSCRIPT07: case eeSCRIPT08: case eeSCRIPT09: case eeSCRIPT10: | ||
| 14958 | case eeSCRIPT11: case eeSCRIPT12: case eeSCRIPT13: case eeSCRIPT14: case eeSCRIPT15: | ||
| 14959 | case eeSCRIPT16: case eeSCRIPT17: case eeSCRIPT18: case eeSCRIPT19: case eeSCRIPT20: | ||
| 14960 | case eeFFRIENDLY01: case eeFFRIENDLY02: case eeFFRIENDLY03: case eeFFRIENDLY04: case eeFFRIENDLY05: | ||
| 14961 | case eeFFRIENDLY06: case eeFFRIENDLY07: case eeFFRIENDLY08: case eeFFRIENDLY09: case eeFFRIENDLY10: | ||
| 14962 | 14832 | tempguy.moveflags = FLAG_OBEYS_GRAV | FLAG_CAN_PITFALL; | |
| 14963 | 14832 | } | |
| 14964 | } | ||
| 14965 |
2/2✓ Branch 0 taken 216576 times.
✓ Branch 1 taken 96768 times.
|
313344 | if(guyversion < 43) |
| 14966 | { | ||
| 14967 |
2/2✓ Branch 0 taken 78757 times.
✓ Branch 1 taken 18011 times.
|
96768 | switch(tempguy.family) |
| 14968 | { | ||
| 14969 | //No gravity; floats over pits | ||
| 14970 | case eeTEK: case eePEAHAT: case eeROCK: case eeTRAP: | ||
| 14971 | case eePROJECTILE: case eeSPINTILE: case eeKEESE: case eeFIRE: | ||
| 14972 | //Special (bosses, etc) | ||
| 14973 | case eeFAIRY: case eeGUY: case eeNONE: case eeZORA: | ||
| 14974 | case eeAQUA: case eeDIG: case eeGHOMA: case eeGANON: | ||
| 14975 | case eePATRA: case eeGLEEOK: case eeMOLD: case eeMANHAN: | ||
| 14976 | case eeWIZZ: case eeWALLM: case eeGHINI: | ||
| 14977 | //Gravity, floats over pits | ||
| 14978 | 78757 | tempguy.moveflags |= FLAG_CAN_WATERWALK; | |
| 14979 | 78757 | tempguy.moveflags |= FLAG_CAN_PITWALK; | |
| 14980 | 78757 | break; | |
| 14981 | } | ||
| 14982 | 96768 | } | |
| 14983 |
2/2✓ Branch 0 taken 216576 times.
✓ Branch 1 taken 96768 times.
|
313344 | if (guyversion < 44) |
| 14984 | { | ||
| 14985 |
2/2✓ Branch 0 taken 95897 times.
✓ Branch 1 taken 871 times.
|
96768 | if ( tempguy.family == eeGHOMA ) |
| 14986 | { | ||
| 14987 | 871 | tempguy.flags |= guy_fadeinstant; | |
| 14988 | 871 | } | |
| 14989 | 96768 | } | |
| 14990 |
2/2✓ Branch 0 taken 216576 times.
✓ Branch 1 taken 96768 times.
|
313344 | if (guyversion > 44) |
| 14991 | { | ||
| 14992 |
1/2✓ Branch 0 taken 216576 times.
✗ Branch 1 not taken.
|
216576 | if(!p_getc(&(tempguy.spr_shadow),f)) |
| 14993 | { | ||
| 14994 | ✗ | return qe_invalid; | |
| 14995 | } | ||
| 14996 |
1/2✓ Branch 0 taken 216576 times.
✗ Branch 1 not taken.
|
216576 | if(!p_getc(&(tempguy.spr_death),f)) |
| 14997 | { | ||
| 14998 | ✗ | return qe_invalid; | |
| 14999 | } | ||
| 15000 |
1/2✓ Branch 0 taken 216576 times.
✗ Branch 1 not taken.
|
216576 | if(!p_getc(&(tempguy.spr_spawn),f)) |
| 15001 | { | ||
| 15002 | ✗ | return qe_invalid; | |
| 15003 | } | ||
| 15004 | 216576 | } | |
| 15005 | else | ||
| 15006 | { | ||
| 15007 |
2/2✓ Branch 0 taken 96392 times.
✓ Branch 1 taken 376 times.
|
96768 | tempguy.spr_shadow = (tempguy.family==eeROCK && tempguy.misc10==1) ? iwLargeShadow : iwShadow; |
| 15008 | 96768 | tempguy.spr_death = iwDeath; | |
| 15009 | 96768 | tempguy.spr_spawn = iwSpawn; | |
| 15010 | } | ||
| 15011 | |||
| 15012 |
2/2✓ Branch 0 taken 216576 times.
✓ Branch 1 taken 96768 times.
|
313344 | if(guyversion < 46) |
| 15013 | { | ||
| 15014 |
4/4✓ Branch 0 taken 13232 times.
✓ Branch 1 taken 83536 times.
✓ Branch 2 taken 12569 times.
✓ Branch 3 taken 663 times.
|
96768 | if(tempguy.family == eeWALK && tempguy.misc9 == e9tPOLSVOICE) |
| 15015 | { | ||
| 15016 | 663 | tempguy.moveflags |= FLAG_CAN_WATERWALK; | |
| 15017 | 663 | } | |
| 15018 | 96768 | } | |
| 15019 | |||
| 15020 |
1/2✓ Branch 0 taken 313344 times.
✗ Branch 1 not taken.
|
313344 | if(loading_tileset_flags & TILESET_CLEARSCRIPTS) |
| 15021 | { | ||
| 15022 | ✗ | tempguy.script = 0; | |
| 15023 | ✗ | for(int q = 0; q < 8; ++q) | |
| 15024 | ✗ | tempguy.initD[q] = 0; | |
| 15025 | ✗ | } | |
| 15026 | 313344 | guysbuf[i] = tempguy; | |
| 15027 | 313344 | } | |
| 15028 | 612 | } | |
| 15029 | |||
| 15030 | 612 | return 0; | |
| 15031 | 694 | } | |
| 15032 | |||
| 15033 | ✗ | void update_guy_1(guydata *tempguy) // November 2009 | |
| 15034 | { | ||
| 15035 | ✗ | bool doesntcount = false; | |
| 15036 | ✗ | tempguy->flags &= ~weak_arrow; // Formerly 'weak to arrow' which wasn't implemented | |
| 15037 | |||
| 15038 | ✗ | switch(tempguy->family) | |
| 15039 | { | ||
| 15040 | case 1: //eeWALK | ||
| 15041 | ✗ | switch(tempguy->misc10) | |
| 15042 | { | ||
| 15043 | case 0: //Stalfos | ||
| 15044 | ✗ | if(tempguy->misc1==1) // Fires four projectiles at once | |
| 15045 | ✗ | tempguy->misc1=4; | |
| 15046 | |||
| 15047 | ✗ | break; | |
| 15048 | |||
| 15049 | case 1: //Darknut | ||
| 15050 | ✗ | goto darknuts; | |
| 15051 | break; | ||
| 15052 | } | ||
| 15053 | |||
| 15054 | ✗ | tempguy->misc10 = 0; | |
| 15055 | ✗ | break; | |
| 15056 | |||
| 15057 | case 2: //eeSHOOT | ||
| 15058 | ✗ | tempguy->family = eeWALK; | |
| 15059 | |||
| 15060 | ✗ | switch(tempguy->misc10) | |
| 15061 | { | ||
| 15062 | case 0: //Octorok | ||
| 15063 | ✗ | if(tempguy->misc1==1||tempguy->misc1==2) | |
| 15064 | { | ||
| 15065 | ✗ | tempguy->misc1=e1tFIREOCTO; | |
| 15066 | ✗ | tempguy->misc2=e2tFIREOCTO; | |
| 15067 | ✗ | } | |
| 15068 | ✗ | else tempguy->misc1 = 0; | |
| 15069 | |||
| 15070 | ✗ | tempguy->misc6=tempguy->misc4; | |
| 15071 | ✗ | tempguy->misc4=tempguy->misc3; | |
| 15072 | ✗ | tempguy->misc3=0; | |
| 15073 | ✗ | break; | |
| 15074 | |||
| 15075 | case 1: // Moblin | ||
| 15076 | ✗ | tempguy->misc1 = 0; | |
| 15077 | ✗ | break; | |
| 15078 | |||
| 15079 | case 2: //Lynel | ||
| 15080 | ✗ | tempguy->misc6=tempguy->misc1+1; | |
| 15081 | ✗ | tempguy->misc1=0; | |
| 15082 | ✗ | break; | |
| 15083 | |||
| 15084 | case 3: //Stalfos 2 | ||
| 15085 | ✗ | if(tempguy->misc1==1) // Fires four projectiles at once | |
| 15086 | ✗ | tempguy->misc1=e1t4SHOTS; | |
| 15087 | ✗ | else tempguy->misc1 = 0; | |
| 15088 | |||
| 15089 | ✗ | break; | |
| 15090 | |||
| 15091 | case 4: //Darknut 5 | ||
| 15092 | darknuts: | ||
| 15093 | ✗ | tempguy->defense[edefFIRE] = edIGNORE; | |
| 15094 | ✗ | tempguy->defense[edefBRANG] = edSTUNORCHINK; | |
| 15095 | ✗ | tempguy->defense[edefHOOKSHOT] = 0; | |
| 15096 | ✗ | tempguy->defense[edefARROW] = tempguy->defense[edefBYRNA] = tempguy->defense[edefREFROCK] = | |
| 15097 | ✗ | tempguy->defense[edefMAGIC] = tempguy->defense[edefSTOMP] = edCHINK; | |
| 15098 | |||
| 15099 | ✗ | if(tempguy->misc1==1) | |
| 15100 | ✗ | tempguy->misc1=2; | |
| 15101 | ✗ | else if(tempguy->misc1==2) | |
| 15102 | { | ||
| 15103 | ✗ | tempguy->misc4=tempguy->misc3; | |
| 15104 | ✗ | tempguy->misc3=tempguy->misc2; | |
| 15105 | ✗ | tempguy->misc2=e2tSPLIT; | |
| 15106 | ✗ | tempguy->misc1 = 0; | |
| 15107 | ✗ | } | |
| 15108 | ✗ | else tempguy->misc1 = 0; | |
| 15109 | |||
| 15110 | ✗ | tempguy->flags |= inv_front; | |
| 15111 | |||
| 15112 | ✗ | if(get_bit(deprecated_rules,qr_BRKBLSHLDS_DEP)) | |
| 15113 | ✗ | tempguy->flags |= guy_bkshield; | |
| 15114 | |||
| 15115 | ✗ | break; | |
| 15116 | } | ||
| 15117 | |||
| 15118 | ✗ | tempguy->misc10 = 0; | |
| 15119 | ✗ | break; | |
| 15120 | |||
| 15121 | /* | ||
| 15122 | case 9: //eeARMOS | ||
| 15123 | tempguy->family = eeWALK; | ||
| 15124 | break; | ||
| 15125 | */ | ||
| 15126 | case 11: //eeGEL | ||
| 15127 | case 33: //eeGELTRIB | ||
| 15128 | ✗ | if(tempguy->family==33) | |
| 15129 | { | ||
| 15130 | ✗ | tempguy->misc4 = 1; | |
| 15131 | |||
| 15132 | ✗ | if(get_bit(deprecated_rules, qr_OLDTRIBBLES_DEP)) //Old Tribbles | |
| 15133 | ✗ | tempguy->misc3 = tempguy->misc2; | |
| 15134 | |||
| 15135 | ✗ | tempguy->misc2 = e2tTRIBBLE; | |
| 15136 | ✗ | } | |
| 15137 | else | ||
| 15138 | { | ||
| 15139 | ✗ | tempguy->misc4 = 0; | |
| 15140 | ✗ | tempguy->misc3 = 0; | |
| 15141 | ✗ | tempguy->misc2 = 0; | |
| 15142 | } | ||
| 15143 | |||
| 15144 | ✗ | tempguy->family = eeWALK; | |
| 15145 | |||
| 15146 | ✗ | if(tempguy->misc1) | |
| 15147 | { | ||
| 15148 | ✗ | tempguy->misc1=1; | |
| 15149 | ✗ | tempguy->weapon = ewFireTrail; | |
| 15150 | ✗ | } | |
| 15151 | |||
| 15152 | ✗ | break; | |
| 15153 | |||
| 15154 | case 34: //eeZOLTRIB | ||
| 15155 | case 12: //eeZOL | ||
| 15156 | ✗ | tempguy->misc4=tempguy->misc3; | |
| 15157 | ✗ | tempguy->misc3=tempguy->misc2; | |
| 15158 | ✗ | tempguy->family = eeWALK; | |
| 15159 | ✗ | tempguy->misc2=e2tSPLITHIT; | |
| 15160 | |||
| 15161 | ✗ | if(tempguy->misc1) | |
| 15162 | { | ||
| 15163 | ✗ | tempguy->misc1=1; | |
| 15164 | ✗ | tempguy->weapon = ewFireTrail; | |
| 15165 | ✗ | } | |
| 15166 | |||
| 15167 | ✗ | break; | |
| 15168 | |||
| 15169 | case 13: //eeROPE | ||
| 15170 | ✗ | tempguy->family = eeWALK; | |
| 15171 | ✗ | tempguy->misc9 = e9tROPE; | |
| 15172 | |||
| 15173 | ✗ | if(tempguy->misc1) | |
| 15174 | { | ||
| 15175 | ✗ | tempguy->misc4 = tempguy->misc3; | |
| 15176 | ✗ | tempguy->misc3 = tempguy->misc2; | |
| 15177 | ✗ | tempguy->misc2 = e2tBOMBCHU; | |
| 15178 | ✗ | } | |
| 15179 | |||
| 15180 | ✗ | tempguy->misc1 = 0; | |
| 15181 | ✗ | break; | |
| 15182 | |||
| 15183 | case 14: //eeGORIYA | ||
| 15184 | ✗ | tempguy->family = eeWALK; | |
| 15185 | |||
| 15186 | ✗ | if(tempguy->misc1!=2) tempguy->misc1 = 0; | |
| 15187 | |||
| 15188 | ✗ | break; | |
| 15189 | |||
| 15190 | case 17: //eeBUBBLE | ||
| 15191 | ✗ | tempguy->family = eeWALK; | |
| 15192 | ✗ | tempguy->misc8 = tempguy->misc2; | |
| 15193 | ✗ | tempguy->misc7 = tempguy->misc1 + 1; | |
| 15194 | ✗ | tempguy->misc1 = tempguy->misc2 = 0; | |
| 15195 | |||
| 15196 | //fallthrogh | ||
| 15197 | case eeTRAP: | ||
| 15198 | case eeROCK: | ||
| 15199 | ✗ | doesntcount = true; | |
| 15200 | ✗ | break; | |
| 15201 | |||
| 15202 | case 35: //eeVIRETRIB | ||
| 15203 | case 18: //eeVIRE | ||
| 15204 | ✗ | tempguy->family = eeWALK; | |
| 15205 | ✗ | tempguy->misc4=tempguy->misc3; | |
| 15206 | ✗ | tempguy->misc3=tempguy->misc2; | |
| 15207 | ✗ | tempguy->misc2=e2tSPLITHIT; | |
| 15208 | ✗ | tempguy->misc9=e9tVIRE; | |
| 15209 | ✗ | break; | |
| 15210 | |||
| 15211 | case 19: //eeLIKE | ||
| 15212 | ✗ | tempguy->family = eeWALK; | |
| 15213 | ✗ | tempguy->misc7 = e7tEATITEMS; | |
| 15214 | ✗ | tempguy->misc8=95; | |
| 15215 | ✗ | break; | |
| 15216 | |||
| 15217 | case 20: //eePOLSV | ||
| 15218 | ✗ | tempguy->defense[edefBRANG] = edSTUNORCHINK; | |
| 15219 | ✗ | tempguy->defense[edefBOMB] = tempguy->defense[edefSBOMB] = tempguy->defense[edefFIRE] = edIGNORE; | |
| 15220 | ✗ | tempguy->defense[edefMAGIC] = tempguy->defense[edefBYRNA] = edCHINK; | |
| 15221 | ✗ | tempguy->defense[edefARROW] = ed1HKO; | |
| 15222 | ✗ | tempguy->defense[edefHOOKSHOT] = edSTUNONLY; | |
| 15223 | ✗ | tempguy->family = eeWALK; | |
| 15224 | ✗ | tempguy->misc9 = e9tPOLSVOICE; | |
| 15225 | ✗ | tempguy->rate = 4; | |
| 15226 | ✗ | tempguy->homing = 32; | |
| 15227 | ✗ | tempguy->hrate = 10; | |
| 15228 | ✗ | tempguy->grumble = 0; | |
| 15229 | ✗ | break; | |
| 15230 | |||
| 15231 | case eeWIZZ: | ||
| 15232 | ✗ | if(tempguy->misc4) | |
| 15233 | { | ||
| 15234 | ✗ | for(int32_t i=0; i < edefLAST; i++) | |
| 15235 | ✗ | tempguy->defense[i] = (i != edefREFBEAM && i != edefREFMAGIC && i != edefQUAKE) ? edIGNORE : 0; | |
| 15236 | ✗ | } | |
| 15237 | else | ||
| 15238 | { | ||
| 15239 | ✗ | tempguy->defense[edefBRANG] = edSTUNORCHINK; | |
| 15240 | ✗ | tempguy->defense[edefMAGIC] = edCHINK; | |
| 15241 | ✗ | tempguy->defense[edefHOOKSHOT] = edSTUNONLY; | |
| 15242 | ✗ | tempguy->defense[edefARROW] = tempguy->defense[edefFIRE] = | |
| 15243 | ✗ | tempguy->defense[edefWAND] = tempguy->defense[edefBYRNA] = edIGNORE; | |
| 15244 | } | ||
| 15245 | |||
| 15246 | ✗ | break; | |
| 15247 | |||
| 15248 | case eePEAHAT: | ||
| 15249 | ✗ | tempguy->flags &= ~(guy_superman|guy_sbombonly); | |
| 15250 | |||
| 15251 | ✗ | if(!(tempguy->flags & guy_bhit)) | |
| 15252 | ✗ | tempguy->defense[edefBRANG] = edSTUNONLY; | |
| 15253 | |||
| 15254 | ✗ | break; | |
| 15255 | |||
| 15256 | case eeLEV: | ||
| 15257 | ✗ | tempguy->defense[edefSTOMP] = edCHINK; | |
| 15258 | ✗ | break; | |
| 15259 | } | ||
| 15260 | |||
| 15261 | // Old flags | ||
| 15262 | ✗ | if(tempguy->flags & guy_superman) | |
| 15263 | { | ||
| 15264 | ✗ | for(int32_t i = 0; i < edefLAST; i++) | |
| 15265 | ✗ | if(!(i==edefSBOMB && (tempguy->flags & guy_sbombonly))) | |
| 15266 | ✗ | tempguy->defense[i] = (i==edefBRANG && tempguy->defense[i] != edIGNORE | |
| 15267 | ✗ | && tempguy->family != eeROCK && tempguy->family != eeTRAP | |
| 15268 | ✗ | && tempguy->family != eePROJECTILE) ? edSTUNORIGNORE : edIGNORE; | |
| 15269 | ✗ | } | |
| 15270 | |||
| 15271 | ✗ | tempguy->flags &= ~(guy_superman|guy_sbombonly); | |
| 15272 | |||
| 15273 | ✗ | if(doesntcount) | |
| 15274 | ✗ | tempguy->flags |= (guy_doesntcount); | |
| 15275 | ✗ | } | |
| 15276 | |||
| 15277 | |||
| 15278 | 1154920 | int32_t readmapscreen_old(PACKFILE *f, zquestheader *Header, mapscr *temp_mapscr, word version) | |
| 15279 | { | ||
| 15280 | byte tempbyte, padding; | ||
| 15281 | int32_t extras, secretcombos; | ||
| 15282 | //al_trace("readmapscreen Header->zelda_version: %x\n",Header->zelda_version); | ||
| 15283 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1154920 times.
|
1154920 | if(!p_getc(&(temp_mapscr->valid),f)) |
| 15284 | { | ||
| 15285 | ✗ | return qe_invalid; | |
| 15286 | } | ||
| 15287 | |||
| 15288 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1154920 times.
|
1154920 | if(!p_getc(&(temp_mapscr->guy),f)) |
| 15289 | ✗ | return qe_invalid; | |
| 15290 | 1154920 | temp_mapscr->guytile = -1; //signal to use default guy values | |
| 15291 |
2/2✓ Branch 0 taken 1154343 times.
✓ Branch 1 taken 577 times.
|
1154920 | SETFLAG(temp_mapscr->roomflags,RFL_ALWAYS_GUY,temp_mapscr->guy==gFAIRY); |
| 15292 |
4/4✓ Branch 0 taken 577 times.
✓ Branch 1 taken 1154343 times.
✓ Branch 2 taken 42 times.
✓ Branch 3 taken 535 times.
|
1154920 | SETFLAG(temp_mapscr->roomflags,RFL_GUYFIRES,temp_mapscr->guy!=gFAIRY || !get_qr(qr_NOFAIRYGUYFIRES)); |
| 15293 | |||
| 15294 |
5/6✓ Branch 0 taken 1132744 times.
✓ Branch 1 taken 22176 times.
✓ Branch 2 taken 2720 times.
✓ Branch 3 taken 1130024 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 2720 times.
|
1154920 | if((Header->zelda_version < 0x192)||((Header->zelda_version == 0x192)&&(Header->build<146))) |
| 15295 | { | ||
| 15296 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 22176 times.
|
22176 | if(!p_getc(&tempbyte,f)) |
| 15297 | { | ||
| 15298 | ✗ | return qe_invalid; | |
| 15299 | } | ||
| 15300 | |||
| 15301 | 22176 | temp_mapscr->str=tempbyte; | |
| 15302 | 22176 | } | |
| 15303 | else | ||
| 15304 | { | ||
| 15305 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1132744 times.
|
1132744 | if(!p_igetw(&(temp_mapscr->str),f)) |
| 15306 | { | ||
| 15307 | ✗ | return qe_invalid; | |
| 15308 | } | ||
| 15309 | } | ||
| 15310 | |||
| 15311 |
1/2✓ Branch 0 taken 1154920 times.
✗ Branch 1 not taken.
|
1154920 | if(!p_getc(&(temp_mapscr->room),f)) |
| 15312 | { | ||
| 15313 | ✗ | return qe_invalid; | |
| 15314 | } | ||
| 15315 | |||
| 15316 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1154920 times.
|
1154920 | if(!p_getc(&(temp_mapscr->item),f)) |
| 15317 | { | ||
| 15318 | ✗ | return qe_invalid; | |
| 15319 | } | ||
| 15320 | |||
| 15321 |
3/6✓ Branch 0 taken 626416 times.
✓ Branch 1 taken 528504 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 626416 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
1154920 | if(Header->zelda_version < 0x211 || (Header->zelda_version == 0x211 && Header->build < 14)) |
| 15322 | { | ||
| 15323 | 528504 | temp_mapscr->hasitem = (temp_mapscr->item != 0) ? 1 : 0; | |
| 15324 | 528504 | } | |
| 15325 | else | ||
| 15326 | { | ||
| 15327 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 626416 times.
|
626416 | if(!p_getc(&(temp_mapscr->hasitem),f)) |
| 15328 | ✗ | return qe_invalid; | |
| 15329 | } | ||
| 15330 | |||
| 15331 |
3/4✓ Branch 0 taken 1132744 times.
✓ Branch 1 taken 22176 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 2720 times.
|
1157640 | if((Header->zelda_version < 0x192)|| |
| 15332 |
2/2✓ Branch 0 taken 2720 times.
✓ Branch 1 taken 1130024 times.
|
1132744 | ((Header->zelda_version == 0x192)&&(Header->build<154))) |
| 15333 | { | ||
| 15334 |
1/2✓ Branch 0 taken 22176 times.
✗ Branch 1 not taken.
|
22176 | if(!p_getc(&tempbyte,f)) |
| 15335 | { | ||
| 15336 | ✗ | return qe_invalid; | |
| 15337 | } | ||
| 15338 | 22176 | } | |
| 15339 | |||
| 15340 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1154920 times.
|
1154920 | if(!p_getc(&(temp_mapscr->tilewarptype[0]),f)) |
| 15341 | { | ||
| 15342 | ✗ | return qe_invalid; | |
| 15343 | } | ||
| 15344 | |||
| 15345 |
2/2✓ Branch 0 taken 1130024 times.
✓ Branch 1 taken 24896 times.
|
1154920 | if(Header->zelda_version < 0x193) |
| 15346 | { | ||
| 15347 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 24896 times.
|
24896 | if(!p_getc(&tempbyte,f)) |
| 15348 | { | ||
| 15349 | ✗ | return qe_invalid; | |
| 15350 | } | ||
| 15351 | 24896 | } | |
| 15352 | |||
| 15353 |
3/6✓ Branch 0 taken 528504 times.
✓ Branch 1 taken 626416 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 528504 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
1154920 | if((Header->zelda_version > 0x211)||((Header->zelda_version == 0x211)&&(Header->build>7))) |
| 15354 | { | ||
| 15355 |
2/2✓ Branch 0 taken 1879248 times.
✓ Branch 1 taken 626416 times.
|
2505664 | for(int32_t i=1; i<4; i++) |
| 15356 | { | ||
| 15357 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1879248 times.
|
1879248 | if(!p_getc(&(temp_mapscr->tilewarptype[i]),f)) |
| 15358 | { | ||
| 15359 | ✗ | return qe_invalid; | |
| 15360 | } | ||
| 15361 | 1879248 | } | |
| 15362 | 626416 | } | |
| 15363 | else | ||
| 15364 | { | ||
| 15365 | 528504 | temp_mapscr->tilewarptype[1]=0; | |
| 15366 | 528504 | temp_mapscr->tilewarptype[2]=0; | |
| 15367 | 528504 | temp_mapscr->tilewarptype[3]=0; | |
| 15368 | } | ||
| 15369 | |||
| 15370 |
5/6✓ Branch 0 taken 24896 times.
✓ Branch 1 taken 1130024 times.
✓ Branch 2 taken 2720 times.
✓ Branch 3 taken 22176 times.
✓ Branch 4 taken 2720 times.
✗ Branch 5 not taken.
|
1154920 | if((Header->zelda_version > 0x192)||((Header->zelda_version == 0x192)&&(Header->build>153))) |
| 15371 | { | ||
| 15372 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1132744 times.
|
1132744 | if(!p_igetw(&(temp_mapscr->door_combo_set),f)) |
| 15373 | { | ||
| 15374 | ✗ | return qe_invalid; | |
| 15375 | } | ||
| 15376 | 1132744 | } | |
| 15377 | |||
| 15378 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1154920 times.
|
1154920 | if(!p_getc(&(temp_mapscr->warpreturnx[0]),f)) |
| 15379 | { | ||
| 15380 | ✗ | return qe_invalid; | |
| 15381 | } | ||
| 15382 | |||
| 15383 | 1154920 | temp_mapscr->warpreturnx[1]=0; | |
| 15384 | 1154920 | temp_mapscr->warpreturnx[2]=0; | |
| 15385 | 1154920 | temp_mapscr->warpreturnx[3]=0; | |
| 15386 | |||
| 15387 |
3/6✓ Branch 0 taken 528504 times.
✓ Branch 1 taken 626416 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 528504 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
1154920 | if((Header->zelda_version > 0x211)||((Header->zelda_version == 0x211)&&(Header->build>7))) |
| 15388 | { | ||
| 15389 |
2/2✓ Branch 0 taken 1879248 times.
✓ Branch 1 taken 626416 times.
|
2505664 | for(int32_t i=1; i<4; i++) |
| 15390 | { | ||
| 15391 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1879248 times.
|
1879248 | if(!p_getc(&(temp_mapscr->warpreturnx[i]),f)) |
| 15392 | { | ||
| 15393 | ✗ | return qe_invalid; | |
| 15394 | } | ||
| 15395 | 1879248 | } | |
| 15396 | 626416 | } | |
| 15397 | |||
| 15398 |
1/2✓ Branch 0 taken 1154920 times.
✗ Branch 1 not taken.
|
1154920 | if(!p_getc(&(temp_mapscr->warpreturny[0]),f)) |
| 15399 | { | ||
| 15400 | ✗ | return qe_invalid; | |
| 15401 | } | ||
| 15402 | |||
| 15403 | 1154920 | temp_mapscr->warpreturny[1]=0; | |
| 15404 | 1154920 | temp_mapscr->warpreturny[2]=0; | |
| 15405 | 1154920 | temp_mapscr->warpreturny[3]=0; | |
| 15406 | |||
| 15407 |
3/6✓ Branch 0 taken 528504 times.
✓ Branch 1 taken 626416 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 528504 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
1154920 | if((Header->zelda_version > 0x211)||((Header->zelda_version == 0x211)&&(Header->build>7))) |
| 15408 | { | ||
| 15409 |
2/2✓ Branch 0 taken 1879248 times.
✓ Branch 1 taken 626416 times.
|
2505664 | for(int32_t i=1; i<4; i++) |
| 15410 | { | ||
| 15411 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1879248 times.
|
1879248 | if(!p_getc(&(temp_mapscr->warpreturny[i]),f)) |
| 15412 | { | ||
| 15413 | ✗ | return qe_invalid; | |
| 15414 | } | ||
| 15415 | 1879248 | } | |
| 15416 | |||
| 15417 |
1/2✓ Branch 0 taken 626416 times.
✗ Branch 1 not taken.
|
626416 | if(version>=18) |
| 15418 | { | ||
| 15419 |
1/2✓ Branch 0 taken 626416 times.
✗ Branch 1 not taken.
|
626416 | if(!p_igetw(&temp_mapscr->warpreturnc,f)) |
| 15420 | { | ||
| 15421 | ✗ | return qe_invalid; | |
| 15422 | } | ||
| 15423 | 626416 | } | |
| 15424 | else | ||
| 15425 | { | ||
| 15426 | byte temp; | ||
| 15427 | |||
| 15428 | ✗ | if(!p_getc(&temp,f)) | |
| 15429 | { | ||
| 15430 | ✗ | return qe_invalid; | |
| 15431 | } | ||
| 15432 | |||
| 15433 | ✗ | temp_mapscr->warpreturnc=temp<<8|temp; | |
| 15434 | } | ||
| 15435 | 626416 | } | |
| 15436 | |||
| 15437 |
1/2✓ Branch 0 taken 1154920 times.
✗ Branch 1 not taken.
|
1154920 | if(!p_getc(&(temp_mapscr->stairx),f)) |
| 15438 | |||
| 15439 | { | ||
| 15440 | ✗ | return qe_invalid; | |
| 15441 | } | ||
| 15442 | |||
| 15443 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1154920 times.
|
1154920 | if(!p_getc(&(temp_mapscr->stairy),f)) |
| 15444 | { | ||
| 15445 | ✗ | return qe_invalid; | |
| 15446 | } | ||
| 15447 | |||
| 15448 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1154920 times.
|
1154920 | if(!p_getc(&(temp_mapscr->itemx),f)) |
| 15449 | { | ||
| 15450 | ✗ | return qe_invalid; | |
| 15451 | } | ||
| 15452 | |||
| 15453 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1154920 times.
|
1154920 | if(!p_getc(&(temp_mapscr->itemy),f)) |
| 15454 | { | ||
| 15455 | ✗ | return qe_invalid; | |
| 15456 | } | ||
| 15457 | |||
| 15458 |
2/2✓ Branch 0 taken 626416 times.
✓ Branch 1 taken 528504 times.
|
1154920 | if(version > 15) // February 2009 |
| 15459 | { | ||
| 15460 |
1/2✓ Branch 0 taken 626416 times.
✗ Branch 1 not taken.
|
626416 | if(!p_igetw(&(temp_mapscr->color),f)) |
| 15461 | { | ||
| 15462 | ✗ | return qe_invalid; | |
| 15463 | } | ||
| 15464 | 626416 | } | |
| 15465 | else | ||
| 15466 | { | ||
| 15467 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 528504 times.
|
528504 | if(!p_getc(& tempbyte,f)) |
| 15468 | { | ||
| 15469 | ✗ | return qe_invalid; | |
| 15470 | } | ||
| 15471 | |||
| 15472 | 528504 | temp_mapscr->color = (word) tempbyte; | |
| 15473 | } | ||
| 15474 | |||
| 15475 |
1/2✓ Branch 0 taken 1154920 times.
✗ Branch 1 not taken.
|
1154920 | if(!p_getc(&(temp_mapscr->enemyflags),f)) |
| 15476 | { | ||
| 15477 | ✗ | return qe_invalid; | |
| 15478 | } | ||
| 15479 | |||
| 15480 |
2/2✓ Branch 0 taken 4619680 times.
✓ Branch 1 taken 1154920 times.
|
5774600 | for(int32_t k=0; k<4; k++) |
| 15481 | { | ||
| 15482 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4619680 times.
|
4619680 | if(!p_getc(&(temp_mapscr->door[k]),f)) |
| 15483 | { | ||
| 15484 | ✗ | return qe_invalid; | |
| 15485 | |||
| 15486 | } | ||
| 15487 | 4619680 | } | |
| 15488 | |||
| 15489 |
2/2✓ Branch 0 taken 528504 times.
✓ Branch 1 taken 626416 times.
|
1154920 | if(version <= 11) |
| 15490 | { | ||
| 15491 |
1/2✓ Branch 0 taken 528504 times.
✗ Branch 1 not taken.
|
528504 | if(!p_getc(&(tempbyte),f)) |
| 15492 | { | ||
| 15493 | ✗ | return qe_invalid; | |
| 15494 | } | ||
| 15495 | |||
| 15496 | 528504 | temp_mapscr->tilewarpdmap[0]=(word)tempbyte; | |
| 15497 | |||
| 15498 |
2/6✓ Branch 0 taken 528504 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 528504 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
528504 | if((Header->zelda_version > 0x211)||((Header->zelda_version == 0x211)&&(Header->build>7))) |
| 15499 | { | ||
| 15500 | ✗ | for(int32_t i=1; i<4; i++) | |
| 15501 | { | ||
| 15502 | ✗ | if(!p_getc(&(tempbyte),f)) | |
| 15503 | { | ||
| 15504 | ✗ | return qe_invalid; | |
| 15505 | } | ||
| 15506 | |||
| 15507 | ✗ | temp_mapscr->tilewarpdmap[i]=(word)tempbyte; | |
| 15508 | ✗ | } | |
| 15509 | ✗ | } | |
| 15510 | else | ||
| 15511 | { | ||
| 15512 | 528504 | temp_mapscr->tilewarpdmap[1]=0; | |
| 15513 | 528504 | temp_mapscr->tilewarpdmap[2]=0; | |
| 15514 | 528504 | temp_mapscr->tilewarpdmap[3]=0; | |
| 15515 | } | ||
| 15516 | 528504 | } | |
| 15517 | else | ||
| 15518 | { | ||
| 15519 |
2/2✓ Branch 0 taken 2505664 times.
✓ Branch 1 taken 626416 times.
|
3132080 | for(int32_t i=0; i<4; i++) |
| 15520 | { | ||
| 15521 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2505664 times.
|
2505664 | if(!p_igetw(&(temp_mapscr->tilewarpdmap[i]),f)) |
| 15522 | { | ||
| 15523 | ✗ | return qe_invalid; | |
| 15524 | } | ||
| 15525 | 2505664 | } | |
| 15526 | } | ||
| 15527 | |||
| 15528 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1154920 times.
|
1154920 | if(!p_getc(&(temp_mapscr->tilewarpscr[0]),f)) |
| 15529 | { | ||
| 15530 | ✗ | return qe_invalid; | |
| 15531 | } | ||
| 15532 | |||
| 15533 |
3/6✓ Branch 0 taken 528504 times.
✓ Branch 1 taken 626416 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 528504 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
1154920 | if((Header->zelda_version > 0x211)||((Header->zelda_version == 0x211)&&(Header->build>7))) |
| 15534 | { | ||
| 15535 |
2/2✓ Branch 0 taken 1879248 times.
✓ Branch 1 taken 626416 times.
|
2505664 | for(int32_t i=1; i<4; i++) |
| 15536 | { | ||
| 15537 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1879248 times.
|
1879248 | if(!p_getc(&(temp_mapscr->tilewarpscr[i]),f)) |
| 15538 | { | ||
| 15539 | ✗ | return qe_invalid; | |
| 15540 | } | ||
| 15541 | 1879248 | } | |
| 15542 | 626416 | } | |
| 15543 | else | ||
| 15544 | { | ||
| 15545 | 528504 | temp_mapscr->tilewarpscr[1]=0; | |
| 15546 | 528504 | temp_mapscr->tilewarpscr[2]=0; | |
| 15547 | 528504 | temp_mapscr->tilewarpscr[3]=0; | |
| 15548 | } | ||
| 15549 | |||
| 15550 |
2/2✓ Branch 0 taken 626416 times.
✓ Branch 1 taken 528504 times.
|
1154920 | if(version >= 15) |
| 15551 | { | ||
| 15552 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 626416 times.
|
626416 | if(!p_getc(&(temp_mapscr->tilewarpoverlayflags),f)) |
| 15553 | { | ||
| 15554 | ✗ | return qe_invalid; | |
| 15555 | } | ||
| 15556 | 626416 | } | |
| 15557 | else | ||
| 15558 | { | ||
| 15559 | 528504 | temp_mapscr->tilewarpoverlayflags=0; | |
| 15560 | } | ||
| 15561 | |||
| 15562 |
1/2✓ Branch 0 taken 1154920 times.
✗ Branch 1 not taken.
|
1154920 | if(!p_getc(&(temp_mapscr->exitdir),f)) |
| 15563 | { | ||
| 15564 | ✗ | return qe_invalid; | |
| 15565 | } | ||
| 15566 | |||
| 15567 |
2/2✓ Branch 0 taken 1130024 times.
✓ Branch 1 taken 24896 times.
|
1154920 | if(Header->zelda_version < 0x193) |
| 15568 | { | ||
| 15569 |
1/2✓ Branch 0 taken 24896 times.
✗ Branch 1 not taken.
|
24896 | if(!p_getc(&tempbyte,f)) |
| 15570 | { | ||
| 15571 | ✗ | return qe_invalid; | |
| 15572 | } | ||
| 15573 | |||
| 15574 | 24896 | } | |
| 15575 | |||
| 15576 |
4/6✓ Branch 0 taken 2720 times.
✓ Branch 1 taken 1152200 times.
✓ Branch 2 taken 2720 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 2720 times.
✗ Branch 5 not taken.
|
1154920 | if((Header->zelda_version == 0x192)&&(Header->build>145)&&(Header->build<154)) |
| 15577 | { | ||
| 15578 | ✗ | if(!p_getc(&padding,f)) | |
| 15579 | { | ||
| 15580 | ✗ | return qe_invalid; | |
| 15581 | } | ||
| 15582 | ✗ | } | |
| 15583 | |||
| 15584 |
2/2✓ Branch 0 taken 11549200 times.
✓ Branch 1 taken 1154920 times.
|
12704120 | for(int32_t k=0; k<10; k++) |
| 15585 | { | ||
| 15586 | /* | ||
| 15587 | if (!temp_mapscr->enemy[k]) | ||
| 15588 | { | ||
| 15589 | continue; | ||
| 15590 | } | ||
| 15591 | */ | ||
| 15592 |
5/6✓ Branch 0 taken 11327440 times.
✓ Branch 1 taken 221760 times.
✓ Branch 2 taken 27200 times.
✓ Branch 3 taken 11300240 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 27200 times.
|
11549200 | if((Header->zelda_version < 0x192)||((Header->zelda_version == 0x192)&&(Header->build<10))) |
| 15593 | { | ||
| 15594 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 221760 times.
|
221760 | if(!p_getc(&tempbyte,f)) |
| 15595 | { | ||
| 15596 | ✗ | return qe_invalid; | |
| 15597 | } | ||
| 15598 | |||
| 15599 | 221760 | temp_mapscr->enemy[k]=tempbyte; | |
| 15600 | 221760 | } | |
| 15601 | else | ||
| 15602 | { | ||
| 15603 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 11327440 times.
|
11327440 | if(!p_igetw(&(temp_mapscr->enemy[k]),f)) |
| 15604 | { | ||
| 15605 | ✗ | return qe_invalid; | |
| 15606 | } | ||
| 15607 | } | ||
| 15608 | |||
| 15609 |
5/6✓ Branch 0 taken 11327440 times.
✓ Branch 1 taken 221760 times.
✓ Branch 2 taken 27200 times.
✓ Branch 3 taken 11300240 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 27200 times.
|
11549200 | if((Header->zelda_version < 0x192)||((Header->zelda_version == 0x192)&&(Header->build<108))) |
| 15610 | { | ||
| 15611 | //using enumerations here is dangerous | ||
| 15612 | //very easy to break old quests -DD | ||
| 15613 |
2/2✓ Branch 0 taken 1342 times.
✓ Branch 1 taken 220418 times.
|
221760 | if(temp_mapscr->enemy[k]>=57) //old eGOHMA1 |
| 15614 | { | ||
| 15615 | 1342 | temp_mapscr->enemy[k]+=5; | |
| 15616 | 1342 | } | |
| 15617 |
2/2✓ Branch 0 taken 220324 times.
✓ Branch 1 taken 94 times.
|
220418 | else if(temp_mapscr->enemy[k]>=52) //old eGLEEOK2 |
| 15618 | { | ||
| 15619 | 94 | temp_mapscr->enemy[k]+=1; | |
| 15620 | 94 | } | |
| 15621 | 221760 | } | |
| 15622 | |||
| 15623 |
2/2✓ Branch 0 taken 6264160 times.
✓ Branch 1 taken 5285040 times.
|
11549200 | if(version < 9) |
| 15624 | { | ||
| 15625 |
2/2✓ Branch 0 taken 5009135 times.
✓ Branch 1 taken 275905 times.
|
5285040 | if(temp_mapscr->enemy[k]>0) |
| 15626 | { | ||
| 15627 | 275905 | temp_mapscr->enemy[k]+=10; | |
| 15628 | 275905 | } | |
| 15629 | 5285040 | } | |
| 15630 | //don't read in any invalid data | ||
| 15631 |
2/2✓ Branch 0 taken 11548750 times.
✓ Branch 1 taken 450 times.
|
11549200 | if ( ((unsigned)temp_mapscr->enemy[k]) > MAXGUYS ) |
| 15632 | { | ||
| 15633 | 450 | al_trace("Tried to read an invalid enemy ID (%d) for tmpscr->enemy[%d]. This has been cleared to 0.\n", temp_mapscr->enemy[k], k); | |
| 15634 | 450 | temp_mapscr->enemy[k] = 0; | |
| 15635 | 450 | } | |
| 15636 | 11549200 | } | |
| 15637 | |||
| 15638 |
1/2✓ Branch 0 taken 1154920 times.
✗ Branch 1 not taken.
|
1154920 | if(!p_getc(&(temp_mapscr->pattern),f)) |
| 15639 | { | ||
| 15640 | ✗ | return qe_invalid; | |
| 15641 | } | ||
| 15642 | |||
| 15643 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1154920 times.
|
1154920 | if(!p_getc(&(temp_mapscr->sidewarptype[0]),f)) |
| 15644 | { | ||
| 15645 | ✗ | return qe_invalid; | |
| 15646 | } | ||
| 15647 | |||
| 15648 |
3/6✓ Branch 0 taken 528504 times.
✓ Branch 1 taken 626416 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 528504 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
1154920 | if((Header->zelda_version > 0x211)||((Header->zelda_version == 0x211)&&(Header->build>7))) |
| 15649 | { | ||
| 15650 |
2/2✓ Branch 0 taken 1879248 times.
✓ Branch 1 taken 626416 times.
|
2505664 | for(int32_t i=1; i<4; i++) |
| 15651 | { | ||
| 15652 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1879248 times.
|
1879248 | if(!p_getc(&(temp_mapscr->sidewarptype[i]),f)) |
| 15653 | { | ||
| 15654 | ✗ | return qe_invalid; | |
| 15655 | } | ||
| 15656 | 1879248 | } | |
| 15657 | 626416 | } | |
| 15658 | else | ||
| 15659 | { | ||
| 15660 | 528504 | temp_mapscr->sidewarptype[1]=0; | |
| 15661 | 528504 | temp_mapscr->sidewarptype[2]=0; | |
| 15662 | 528504 | temp_mapscr->sidewarptype[3]=0; | |
| 15663 | } | ||
| 15664 | |||
| 15665 |
2/2✓ Branch 0 taken 626416 times.
✓ Branch 1 taken 528504 times.
|
1154920 | if(version >= 15) |
| 15666 | { | ||
| 15667 |
1/2✓ Branch 0 taken 626416 times.
✗ Branch 1 not taken.
|
626416 | if(!p_getc(&(temp_mapscr->sidewarpoverlayflags),f)) |
| 15668 | { | ||
| 15669 | ✗ | return qe_invalid; | |
| 15670 | } | ||
| 15671 | 626416 | } | |
| 15672 | else | ||
| 15673 | { | ||
| 15674 | 528504 | temp_mapscr->sidewarpoverlayflags=0; | |
| 15675 | } | ||
| 15676 | |||
| 15677 |
1/2✓ Branch 0 taken 1154920 times.
✗ Branch 1 not taken.
|
1154920 | if(!p_getc(&(temp_mapscr->warparrivalx),f)) |
| 15678 | { | ||
| 15679 | ✗ | return qe_invalid; | |
| 15680 | } | ||
| 15681 | |||
| 15682 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1154920 times.
|
1154920 | if(!p_getc(&(temp_mapscr->warparrivaly),f)) |
| 15683 | { | ||
| 15684 | ✗ | return qe_invalid; | |
| 15685 | } | ||
| 15686 | |||
| 15687 |
2/2✓ Branch 0 taken 4619680 times.
✓ Branch 1 taken 1154920 times.
|
5774600 | for(int32_t k=0; k<4; k++) |
| 15688 | { | ||
| 15689 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4619680 times.
|
4619680 | if(!p_getc(&(temp_mapscr->path[k]),f)) |
| 15690 | { | ||
| 15691 | ✗ | return qe_invalid; | |
| 15692 | } | ||
| 15693 | 4619680 | } | |
| 15694 | |||
| 15695 |
1/2✓ Branch 0 taken 1154920 times.
✗ Branch 1 not taken.
|
1154920 | if(!p_getc(&(temp_mapscr->sidewarpscr[0]),f)) |
| 15696 | { | ||
| 15697 | ✗ | return qe_invalid; | |
| 15698 | } | ||
| 15699 | |||
| 15700 |
3/6✓ Branch 0 taken 528504 times.
✓ Branch 1 taken 626416 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 528504 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
1154920 | if((Header->zelda_version > 0x211)||((Header->zelda_version == 0x211)&&(Header->build>7))) |
| 15701 | { | ||
| 15702 |
2/2✓ Branch 0 taken 626416 times.
✓ Branch 1 taken 1879248 times.
|
2505664 | for(int32_t i=1; i<4; i++) |
| 15703 | { | ||
| 15704 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1879248 times.
|
1879248 | if(!p_getc(&(temp_mapscr->sidewarpscr[i]),f)) |
| 15705 | { | ||
| 15706 | ✗ | return qe_invalid; | |
| 15707 | } | ||
| 15708 | 1879248 | } | |
| 15709 | 626416 | } | |
| 15710 | else | ||
| 15711 | { | ||
| 15712 | 528504 | temp_mapscr->sidewarpscr[1]=0; | |
| 15713 | 528504 | temp_mapscr->sidewarpscr[2]=0; | |
| 15714 | 528504 | temp_mapscr->sidewarpscr[3]=0; | |
| 15715 | } | ||
| 15716 | |||
| 15717 |
2/2✓ Branch 0 taken 528504 times.
✓ Branch 1 taken 626416 times.
|
1154920 | if(version <= 11) |
| 15718 | { | ||
| 15719 |
1/2✓ Branch 0 taken 528504 times.
✗ Branch 1 not taken.
|
528504 | if(!p_getc(&(tempbyte),f)) |
| 15720 | { | ||
| 15721 | ✗ | return qe_invalid; | |
| 15722 | } | ||
| 15723 | |||
| 15724 | 528504 | temp_mapscr->sidewarpdmap[0]=(word)tempbyte; | |
| 15725 | |||
| 15726 |
2/6✓ Branch 0 taken 528504 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 528504 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
528504 | if((Header->zelda_version > 0x211)||((Header->zelda_version == 0x211)&&(Header->build>7))) |
| 15727 | { | ||
| 15728 | ✗ | for(int32_t i=1; i<4; i++) | |
| 15729 | { | ||
| 15730 | ✗ | if(!p_getc(&(tempbyte),f)) | |
| 15731 | { | ||
| 15732 | ✗ | return qe_invalid; | |
| 15733 | } | ||
| 15734 | |||
| 15735 | ✗ | temp_mapscr->sidewarpdmap[i]=(word)tempbyte; | |
| 15736 | ✗ | } | |
| 15737 | ✗ | } | |
| 15738 | else | ||
| 15739 | { | ||
| 15740 | 528504 | temp_mapscr->sidewarpdmap[1]=0; | |
| 15741 | 528504 | temp_mapscr->sidewarpdmap[2]=0; | |
| 15742 | 528504 | temp_mapscr->sidewarpdmap[3]=0; | |
| 15743 | } | ||
| 15744 | 528504 | } | |
| 15745 | else | ||
| 15746 | { | ||
| 15747 |
2/2✓ Branch 0 taken 2505664 times.
✓ Branch 1 taken 626416 times.
|
3132080 | for(int32_t i=0; i<4; i++) |
| 15748 | { | ||
| 15749 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2505664 times.
|
2505664 | if(!p_igetw(&(temp_mapscr->sidewarpdmap[i]),f)) |
| 15750 | { | ||
| 15751 | ✗ | return qe_invalid; | |
| 15752 | } | ||
| 15753 | 2505664 | } | |
| 15754 | } | ||
| 15755 | |||
| 15756 |
3/6✓ Branch 0 taken 528504 times.
✓ Branch 1 taken 626416 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 528504 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
1154920 | if((Header->zelda_version > 0x211)||((Header->zelda_version == 0x211)&&(Header->build>7))) |
| 15757 | { | ||
| 15758 |
1/2✓ Branch 0 taken 626416 times.
✗ Branch 1 not taken.
|
626416 | if(!p_getc(&(temp_mapscr->sidewarpindex),f)) |
| 15759 | { | ||
| 15760 | ✗ | return qe_invalid; | |
| 15761 | } | ||
| 15762 | 626416 | } | |
| 15763 | 528504 | else temp_mapscr->sidewarpindex = 0; | |
| 15764 | |||
| 15765 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1154920 times.
|
1154920 | if(!p_igetw(&(temp_mapscr->undercombo),f)) |
| 15766 | { | ||
| 15767 | ✗ | return qe_invalid; | |
| 15768 | } | ||
| 15769 | |||
| 15770 |
2/2✓ Branch 0 taken 1130024 times.
✓ Branch 1 taken 24896 times.
|
1154920 | if(Header->zelda_version < 0x193) |
| 15771 | { | ||
| 15772 |
1/2✓ Branch 0 taken 24896 times.
✗ Branch 1 not taken.
|
24896 | if(!p_getc(&(temp_mapscr->old_cpage),f)) |
| 15773 | { | ||
| 15774 | ✗ | return qe_invalid; | |
| 15775 | } | ||
| 15776 | 24896 | } | |
| 15777 | |||
| 15778 |
1/2✓ Branch 0 taken 1154920 times.
✗ Branch 1 not taken.
|
1154920 | if(!p_getc(&(temp_mapscr->undercset),f)) //recalculated for older quests |
| 15779 | { | ||
| 15780 | ✗ | return qe_invalid; | |
| 15781 | } | ||
| 15782 | |||
| 15783 |
1/2✓ Branch 0 taken 1154920 times.
✗ Branch 1 not taken.
|
1154920 | if(!p_igetw(&(temp_mapscr->catchall),f)) |
| 15784 | { | ||
| 15785 | ✗ | return qe_invalid; | |
| 15786 | } | ||
| 15787 | |||
| 15788 |
1/2✓ Branch 0 taken 1154920 times.
✗ Branch 1 not taken.
|
1154920 | if(!p_getc(&(temp_mapscr->flags),f)) |
| 15789 | { | ||
| 15790 | ✗ | return qe_invalid; | |
| 15791 | } | ||
| 15792 | |||
| 15793 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1154920 times.
|
1154920 | if(!p_getc(&(temp_mapscr->flags2),f)) |
| 15794 | { | ||
| 15795 | ✗ | return qe_invalid; | |
| 15796 | } | ||
| 15797 | |||
| 15798 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1154920 times.
|
1154920 | if(!p_getc(&(temp_mapscr->flags3),f)) |
| 15799 | { | ||
| 15800 | ✗ | return qe_invalid; | |
| 15801 | } | ||
| 15802 | |||
| 15803 |
3/6✓ Branch 0 taken 528504 times.
✓ Branch 1 taken 626416 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 528504 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
1154920 | if((Header->zelda_version > 0x211)||((Header->zelda_version == 0x211)&&(Header->build>1))) |
| 15804 | //if (version>2) | ||
| 15805 | { | ||
| 15806 |
1/2✓ Branch 0 taken 626416 times.
✗ Branch 1 not taken.
|
626416 | if(!p_getc(&(temp_mapscr->flags4),f)) |
| 15807 | { | ||
| 15808 | ✗ | return qe_invalid; | |
| 15809 | } | ||
| 15810 | 626416 | } | |
| 15811 | |||
| 15812 |
3/6✓ Branch 0 taken 528504 times.
✓ Branch 1 taken 626416 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 528504 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
1154920 | if((Header->zelda_version > 0x211)||((Header->zelda_version == 0x211)&&(Header->build>7))) |
| 15813 | { | ||
| 15814 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 626416 times.
|
626416 | if(!p_getc(&(temp_mapscr->flags5),f)) |
| 15815 | { | ||
| 15816 | ✗ | return qe_invalid; | |
| 15817 | } | ||
| 15818 | |||
| 15819 |
1/2✓ Branch 0 taken 626416 times.
✗ Branch 1 not taken.
|
626416 | if(!p_igetw(&(temp_mapscr->noreset),f)) |
| 15820 | { | ||
| 15821 | ✗ | return qe_invalid; | |
| 15822 | } | ||
| 15823 | |||
| 15824 |
1/2✓ Branch 0 taken 626416 times.
✗ Branch 1 not taken.
|
626416 | if(!p_igetw(&(temp_mapscr->nocarry),f)) |
| 15825 | { | ||
| 15826 | ✗ | return qe_invalid; | |
| 15827 | } | ||
| 15828 | |||
| 15829 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 626416 times.
|
626416 | if(temp_mapscr->flags5&32) |
| 15830 | { | ||
| 15831 | ✗ | temp_mapscr->flags5 &= ~32; | |
| 15832 | ✗ | temp_mapscr->noreset |= 48; | |
| 15833 | ✗ | } | |
| 15834 | |||
| 15835 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 626416 times.
|
626416 | if(version<8) |
| 15836 | { | ||
| 15837 | ✗ | if(temp_mapscr->noreset&1) | |
| 15838 | { | ||
| 15839 | ✗ | temp_mapscr->noreset|=8192; | |
| 15840 | ✗ | } | |
| 15841 | |||
| 15842 | ✗ | if(temp_mapscr->nocarry&1) | |
| 15843 | { | ||
| 15844 | ✗ | temp_mapscr->nocarry|=8192; | |
| 15845 | ✗ | temp_mapscr->nocarry&=~1; | |
| 15846 | ✗ | } | |
| 15847 | ✗ | } | |
| 15848 | 626416 | } | |
| 15849 | else | ||
| 15850 | { | ||
| 15851 | 528504 | temp_mapscr->flags5 = 0; | |
| 15852 | 528504 | temp_mapscr->noreset = 0; | |
| 15853 | 528504 | temp_mapscr->nocarry = 0; | |
| 15854 | } | ||
| 15855 | |||
| 15856 |
3/6✓ Branch 0 taken 528504 times.
✓ Branch 1 taken 626416 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 528504 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
1154920 | if((Header->zelda_version > 0x211)||((Header->zelda_version == 0x211)&&(Header->build>9))) |
| 15857 | { | ||
| 15858 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 626416 times.
|
626416 | if(!p_getc(&(temp_mapscr->flags6),f)) |
| 15859 | { | ||
| 15860 | ✗ | return qe_invalid; | |
| 15861 | } | ||
| 15862 | 626416 | } | |
| 15863 | |||
| 15864 |
2/2✓ Branch 0 taken 626416 times.
✓ Branch 1 taken 528504 times.
|
1154920 | if(version>5) |
| 15865 | { | ||
| 15866 |
1/2✓ Branch 0 taken 626416 times.
✗ Branch 1 not taken.
|
626416 | if(!p_getc(&(temp_mapscr->flags7),f)) |
| 15867 | { | ||
| 15868 | ✗ | return qe_invalid; | |
| 15869 | } | ||
| 15870 | |||
| 15871 |
1/2✓ Branch 0 taken 626416 times.
✗ Branch 1 not taken.
|
626416 | if(!p_getc(&(temp_mapscr->flags8),f)) |
| 15872 | { | ||
| 15873 | ✗ | return qe_invalid; | |
| 15874 | } | ||
| 15875 | |||
| 15876 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 626416 times.
|
626416 | if(!p_getc(&(temp_mapscr->flags9),f)) |
| 15877 | { | ||
| 15878 | ✗ | return qe_invalid; | |
| 15879 | } | ||
| 15880 | |||
| 15881 |
1/2✓ Branch 0 taken 626416 times.
✗ Branch 1 not taken.
|
626416 | if(!p_getc(&(temp_mapscr->flags10),f)) |
| 15882 | { | ||
| 15883 | ✗ | return qe_invalid; | |
| 15884 | } | ||
| 15885 | |||
| 15886 |
1/2✓ Branch 0 taken 626416 times.
✗ Branch 1 not taken.
|
626416 | if(!p_getc(&(temp_mapscr->csensitive),f)) |
| 15887 | { | ||
| 15888 | ✗ | return qe_invalid; | |
| 15889 | } | ||
| 15890 | 626416 | } | |
| 15891 | else | ||
| 15892 | { | ||
| 15893 | 528504 | temp_mapscr->csensitive=1; | |
| 15894 | } | ||
| 15895 | |||
| 15896 |
2/2✓ Branch 0 taken 528504 times.
✓ Branch 1 taken 626416 times.
|
1154920 | if(version<14) // August 2007: screen SFX added |
| 15897 | { | ||
| 15898 |
2/2✓ Branch 0 taken 527510 times.
✓ Branch 1 taken 994 times.
|
528504 | if(temp_mapscr->flags&8) //fROAR |
| 15899 | { | ||
| 15900 | 994 | temp_mapscr->bosssfx= | |
| 15901 |
2/2✓ Branch 0 taken 141 times.
✓ Branch 1 taken 853 times.
|
994 | (temp_mapscr->flags3&2) ? WAV_DODONGO : // fDODONGO |
| 15902 | 853 | (temp_mapscr->flags2&32) ? WAV_VADER : // fVADER | |
| 15903 | WAV_ROAR; | ||
| 15904 | 994 | } | |
| 15905 | |||
| 15906 |
2/2✓ Branch 0 taken 170 times.
✓ Branch 1 taken 528334 times.
|
528504 | if(temp_mapscr->flags&128) //fSEA |
| 15907 | { | ||
| 15908 | 170 | temp_mapscr->oceansfx=WAV_SEA; | |
| 15909 | 170 | } | |
| 15910 | |||
| 15911 | 528504 | temp_mapscr->secretsfx = (temp_mapscr->flags3&64) //fNOSECRETSOUND | |
| 15912 | ? 0 : WAV_SECRET; | ||
| 15913 | |||
| 15914 | 528504 | temp_mapscr->flags3 &= ~66; //64|2 | |
| 15915 | 528504 | temp_mapscr->flags2 &= ~32; | |
| 15916 | 528504 | temp_mapscr->flags &= ~136; // 128|8 | |
| 15917 | 528504 | } | |
| 15918 | else | ||
| 15919 | { | ||
| 15920 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 626416 times.
|
626416 | if(!p_getc(&(temp_mapscr->oceansfx),f)) |
| 15921 | { | ||
| 15922 | ✗ | return qe_invalid; | |
| 15923 | } | ||
| 15924 | |||
| 15925 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 626416 times.
|
626416 | if(!p_getc(&(temp_mapscr->bosssfx),f)) |
| 15926 | { | ||
| 15927 | ✗ | return qe_invalid; | |
| 15928 | } | ||
| 15929 | |||
| 15930 |
1/2✓ Branch 0 taken 626416 times.
✗ Branch 1 not taken.
|
626416 | if(!p_getc(&(temp_mapscr->secretsfx),f)) |
| 15931 | { | ||
| 15932 | ✗ | return qe_invalid; | |
| 15933 | } | ||
| 15934 | } | ||
| 15935 | |||
| 15936 |
2/2✓ Branch 0 taken 528504 times.
✓ Branch 1 taken 626416 times.
|
1154920 | if(version<15) // October 2007: another SFX |
| 15937 | { | ||
| 15938 | 528504 | temp_mapscr->holdupsfx=WAV_PICKUP; | |
| 15939 | 528504 | } | |
| 15940 | else | ||
| 15941 | { | ||
| 15942 |
1/2✓ Branch 0 taken 626416 times.
✗ Branch 1 not taken.
|
626416 | if(!p_getc(&(temp_mapscr->holdupsfx),f)) |
| 15943 | { | ||
| 15944 | ✗ | return qe_invalid; | |
| 15945 | } | ||
| 15946 | } | ||
| 15947 | |||
| 15948 | |||
| 15949 |
5/6✓ Branch 0 taken 24896 times.
✓ Branch 1 taken 1130024 times.
✓ Branch 2 taken 2720 times.
✓ Branch 3 taken 22176 times.
✓ Branch 4 taken 2720 times.
✗ Branch 5 not taken.
|
1154920 | if((Header->zelda_version > 0x192)||((Header->zelda_version == 0x192)&&(Header->build>97))) |
| 15950 | { | ||
| 15951 |
2/2✓ Branch 0 taken 6796464 times.
✓ Branch 1 taken 1132744 times.
|
7929208 | for(int32_t k=0; k<6; k++) |
| 15952 | { | ||
| 15953 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 6796464 times.
|
6796464 | if(!p_getc(&(temp_mapscr->layermap[k]),f)) |
| 15954 | { | ||
| 15955 | ✗ | return qe_invalid; | |
| 15956 | } | ||
| 15957 | 6796464 | } | |
| 15958 | |||
| 15959 |
2/2✓ Branch 0 taken 1132744 times.
✓ Branch 1 taken 6796464 times.
|
7929208 | for(int32_t k=0; k<6; k++) |
| 15960 | { | ||
| 15961 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 6796464 times.
|
6796464 | if(!p_getc(&(temp_mapscr->layerscreen[k]),f)) |
| 15962 | { | ||
| 15963 | ✗ | return qe_invalid; | |
| 15964 | } | ||
| 15965 | 6796464 | } | |
| 15966 | 1132744 | } | |
| 15967 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 22176 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
22176 | else if((Header->zelda_version == 0x192)&&(Header->build>23)&&(Header->build<98)) |
| 15968 | { | ||
| 15969 | ✗ | if(!p_getc(&(temp_mapscr->layermap[2]),f)) | |
| 15970 | { | ||
| 15971 | ✗ | return qe_invalid; | |
| 15972 | } | ||
| 15973 | |||
| 15974 | ✗ | if(!p_getc(&(temp_mapscr->layerscreen[2]),f)) | |
| 15975 | { | ||
| 15976 | ✗ | return qe_invalid; | |
| 15977 | } | ||
| 15978 | |||
| 15979 | ✗ | if(!p_getc(&(temp_mapscr->layermap[4]),f)) | |
| 15980 | { | ||
| 15981 | ✗ | return qe_invalid; | |
| 15982 | } | ||
| 15983 | |||
| 15984 | ✗ | if(!p_getc(&(temp_mapscr->layerscreen[4]),f)) | |
| 15985 | |||
| 15986 | { | ||
| 15987 | ✗ | return qe_invalid; | |
| 15988 | } | ||
| 15989 | ✗ | } | |
| 15990 | |||
| 15991 |
3/4✓ Branch 0 taken 2720 times.
✓ Branch 1 taken 1152200 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 2720 times.
|
1154920 | if((Header->zelda_version == 0x192)&&(Header->build>149)) |
| 15992 | { | ||
| 15993 |
2/2✓ Branch 0 taken 16320 times.
✓ Branch 1 taken 2720 times.
|
19040 | for(int32_t k=0; k<6; k++) |
| 15994 | { | ||
| 15995 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 16320 times.
|
16320 | if(!p_getc(&tempbyte,f)) //layerxsize |
| 15996 | { | ||
| 15997 | ✗ | return qe_invalid; | |
| 15998 | } | ||
| 15999 | 16320 | } | |
| 16000 | |||
| 16001 |
2/2✓ Branch 0 taken 16320 times.
✓ Branch 1 taken 2720 times.
|
19040 | for(int32_t k=0; k<6; k++) |
| 16002 | { | ||
| 16003 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 16320 times.
|
16320 | if(!p_getc(&tempbyte,f)) //layerxspeed |
| 16004 | { | ||
| 16005 | ✗ | return qe_invalid; | |
| 16006 | } | ||
| 16007 | 16320 | } | |
| 16008 | |||
| 16009 |
2/2✓ Branch 0 taken 16320 times.
✓ Branch 1 taken 2720 times.
|
19040 | for(int32_t k=0; k<6; k++) |
| 16010 | { | ||
| 16011 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 16320 times.
|
16320 | if(!p_getc(&tempbyte,f)) //layerxdelay |
| 16012 | { | ||
| 16013 | ✗ | return qe_invalid; | |
| 16014 | } | ||
| 16015 | 16320 | } | |
| 16016 | |||
| 16017 |
2/2✓ Branch 0 taken 16320 times.
✓ Branch 1 taken 2720 times.
|
19040 | for(int32_t k=0; k<6; k++) |
| 16018 | { | ||
| 16019 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 16320 times.
|
16320 | if(!p_getc(&tempbyte,f)) //layerysize |
| 16020 | { | ||
| 16021 | ✗ | return qe_invalid; | |
| 16022 | } | ||
| 16023 | 16320 | } | |
| 16024 | |||
| 16025 |
2/2✓ Branch 0 taken 16320 times.
✓ Branch 1 taken 2720 times.
|
19040 | for(int32_t k=0; k<6; k++) |
| 16026 | { | ||
| 16027 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 16320 times.
|
16320 | if(!p_getc(&tempbyte,f)) //layeryspeed |
| 16028 | { | ||
| 16029 | ✗ | return qe_invalid; | |
| 16030 | } | ||
| 16031 | 16320 | } | |
| 16032 | |||
| 16033 |
2/2✓ Branch 0 taken 2720 times.
✓ Branch 1 taken 16320 times.
|
19040 | for(int32_t k=0; k<6; k++) |
| 16034 | { | ||
| 16035 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 16320 times.
|
16320 | if(!p_getc(&tempbyte,f)) //layerydelay |
| 16036 | { | ||
| 16037 | ✗ | return qe_invalid; | |
| 16038 | } | ||
| 16039 | 16320 | } | |
| 16040 | 2720 | } | |
| 16041 | |||
| 16042 |
5/6✓ Branch 0 taken 24896 times.
✓ Branch 1 taken 1130024 times.
✓ Branch 2 taken 2720 times.
✓ Branch 3 taken 22176 times.
✓ Branch 4 taken 2720 times.
✗ Branch 5 not taken.
|
1154920 | if((Header->zelda_version > 0x192)||((Header->zelda_version == 0x192)&&(Header->build>149))) |
| 16043 | { | ||
| 16044 |
2/2✓ Branch 0 taken 6796464 times.
✓ Branch 1 taken 1132744 times.
|
7929208 | for(int32_t k=0; k<6; k++) |
| 16045 | { | ||
| 16046 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 6796464 times.
|
6796464 | if(!p_getc(&(temp_mapscr->layeropacity[k]),f)) |
| 16047 | { | ||
| 16048 | ✗ | return qe_invalid; | |
| 16049 | } | ||
| 16050 | 6796464 | } | |
| 16051 | 1132744 | } | |
| 16052 | |||
| 16053 |
5/6✓ Branch 0 taken 24896 times.
✓ Branch 1 taken 1130024 times.
✓ Branch 2 taken 2720 times.
✓ Branch 3 taken 22176 times.
✓ Branch 4 taken 2720 times.
✗ Branch 5 not taken.
|
1154920 | if((Header->zelda_version > 0x192)||((Header->zelda_version == 0x192)&&(Header->build>153))) |
| 16054 | { | ||
| 16055 |
3/4✓ Branch 0 taken 2720 times.
✓ Branch 1 taken 1130024 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 2720 times.
|
1132744 | if((Header->zelda_version == 0x192)&&(Header->build>153)) |
| 16056 | { | ||
| 16057 |
1/2✓ Branch 0 taken 2720 times.
✗ Branch 1 not taken.
|
2720 | if(!p_getc(&padding,f)) |
| 16058 | { | ||
| 16059 | ✗ | return qe_invalid; | |
| 16060 | } | ||
| 16061 | 2720 | } | |
| 16062 | |||
| 16063 |
1/2✓ Branch 0 taken 1132744 times.
✗ Branch 1 not taken.
|
1132744 | if(!p_igetw(&(temp_mapscr->timedwarptics),f)) |
| 16064 | { | ||
| 16065 | ✗ | return qe_invalid; | |
| 16066 | } | ||
| 16067 | 1132744 | } | |
| 16068 | |||
| 16069 |
5/6✓ Branch 0 taken 1132744 times.
✓ Branch 1 taken 22176 times.
✓ Branch 2 taken 2720 times.
✓ Branch 3 taken 1130024 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 2720 times.
|
1154920 | if((Header->zelda_version < 0x192)||((Header->zelda_version == 0x192)&&(Header->build<24))) |
| 16070 | { | ||
| 16071 | 22176 | extras=15; | |
| 16072 | 22176 | } | |
| 16073 |
3/4✓ Branch 0 taken 2720 times.
✓ Branch 1 taken 1130024 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 2720 times.
|
1132744 | else if(((Header->zelda_version == 0x192)&&(Header->build<98))) |
| 16074 | { | ||
| 16075 | ✗ | extras=11; | |
| 16076 | ✗ | } | |
| 16077 |
3/4✓ Branch 0 taken 2720 times.
✓ Branch 1 taken 1130024 times.
✓ Branch 2 taken 2720 times.
✗ Branch 3 not taken.
|
1132744 | else if((Header->zelda_version == 0x192)&&(Header->build<150)) |
| 16078 | { | ||
| 16079 | ✗ | extras=32; | |
| 16080 | ✗ | } | |
| 16081 |
3/4✓ Branch 0 taken 2720 times.
✓ Branch 1 taken 1130024 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 2720 times.
|
1132744 | else if((Header->zelda_version == 0x192)&&(Header->build<154)) |
| 16082 | { | ||
| 16083 | ✗ | extras=64; | |
| 16084 | ✗ | } | |
| 16085 |
2/2✓ Branch 0 taken 2720 times.
✓ Branch 1 taken 1130024 times.
|
1132744 | else if(Header->zelda_version < 0x193) |
| 16086 | { | ||
| 16087 | 2720 | extras=62; | |
| 16088 | 2720 | } | |
| 16089 | else | ||
| 16090 | |||
| 16091 | { | ||
| 16092 | 1130024 | extras=0; | |
| 16093 | } | ||
| 16094 | |||
| 16095 |
2/2✓ Branch 0 taken 501280 times.
✓ Branch 1 taken 1154920 times.
|
1656200 | for(int32_t k=0; k<extras; k++) |
| 16096 | { | ||
| 16097 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 501280 times.
|
501280 | if(!p_getc(&tempbyte,f)) //extra[k] |
| 16098 | { | ||
| 16099 | ✗ | return qe_invalid; | |
| 16100 | } | ||
| 16101 | 501280 | } | |
| 16102 | |||
| 16103 |
3/6✓ Branch 0 taken 528504 times.
✓ Branch 1 taken 626416 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 528504 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
1154920 | if((Header->zelda_version > 0x211)||((Header->zelda_version == 0x211)&&(Header->build>2))) |
| 16104 | //if (version>3) | ||
| 16105 | { | ||
| 16106 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 626416 times.
|
626416 | if(!p_getc(&(temp_mapscr->nextmap),f)) |
| 16107 | { | ||
| 16108 | ✗ | return qe_invalid; | |
| 16109 | } | ||
| 16110 | |||
| 16111 |
1/2✓ Branch 0 taken 626416 times.
✗ Branch 1 not taken.
|
626416 | if(!p_getc(&(temp_mapscr->nextscr),f)) |
| 16112 | { | ||
| 16113 | ✗ | return qe_invalid; | |
| 16114 | } | ||
| 16115 | 626416 | } | |
| 16116 | else | ||
| 16117 | { | ||
| 16118 | 528504 | temp_mapscr->nextmap=0; | |
| 16119 | 528504 | temp_mapscr->nextscr=0; | |
| 16120 | } | ||
| 16121 | |||
| 16122 |
5/6✓ Branch 0 taken 1132744 times.
✓ Branch 1 taken 22176 times.
✓ Branch 2 taken 2720 times.
✓ Branch 3 taken 1130024 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 2720 times.
|
1154920 | if((Header->zelda_version < 0x192)||((Header->zelda_version == 0x192)&&(Header->build<137))) |
| 16123 | { | ||
| 16124 | 22176 | secretcombos=20; | |
| 16125 | 22176 | } | |
| 16126 |
3/4✓ Branch 0 taken 2720 times.
✓ Branch 1 taken 1130024 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 2720 times.
|
1132744 | else if((Header->zelda_version == 0x192)&&(Header->build<154)) |
| 16127 | { | ||
| 16128 | ✗ | secretcombos=256; | |
| 16129 | ✗ | } | |
| 16130 | else | ||
| 16131 | { | ||
| 16132 | 1132744 | secretcombos=128; | |
| 16133 | } | ||
| 16134 | |||
| 16135 |
5/6✓ Branch 0 taken 1132744 times.
✓ Branch 1 taken 22176 times.
✓ Branch 2 taken 2720 times.
✓ Branch 3 taken 1130024 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 2720 times.
|
1154920 | if((Header->zelda_version < 0x192)||((Header->zelda_version == 0x192)&&(Header->build<154))) |
| 16136 | { | ||
| 16137 |
2/2✓ Branch 0 taken 443520 times.
✓ Branch 1 taken 22176 times.
|
465696 | for(int32_t k=0; k<secretcombos; k++) |
| 16138 | { | ||
| 16139 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 443520 times.
|
443520 | if(!p_getc(&tempbyte,f)) |
| 16140 | { | ||
| 16141 | ✗ | return qe_invalid; | |
| 16142 | } | ||
| 16143 | |||
| 16144 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 443520 times.
|
443520 | if(k<128) |
| 16145 | { | ||
| 16146 | 443520 | temp_mapscr->secretcombo[k]=tempbyte; | |
| 16147 | 443520 | } | |
| 16148 | 443520 | } | |
| 16149 | 22176 | } | |
| 16150 | else | ||
| 16151 | { | ||
| 16152 |
2/2✓ Branch 0 taken 144991232 times.
✓ Branch 1 taken 1132744 times.
|
146123976 | for(int32_t k=0; k<128; k++) |
| 16153 | { | ||
| 16154 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 144991232 times.
|
144991232 | if(!p_igetw(&(temp_mapscr->secretcombo[k]),f)) |
| 16155 | { | ||
| 16156 | ✗ | return qe_invalid; | |
| 16157 | } | ||
| 16158 | |||
| 16159 | 144991232 | } | |
| 16160 | } | ||
| 16161 | |||
| 16162 |
5/6✓ Branch 0 taken 24896 times.
✓ Branch 1 taken 1130024 times.
✓ Branch 2 taken 2720 times.
✓ Branch 3 taken 22176 times.
✓ Branch 4 taken 2720 times.
✗ Branch 5 not taken.
|
1154920 | if((Header->zelda_version > 0x192)||((Header->zelda_version == 0x192)&&(Header->build>153))) |
| 16163 | { | ||
| 16164 |
2/2✓ Branch 0 taken 144991232 times.
✓ Branch 1 taken 1132744 times.
|
146123976 | for(int32_t k=0; k<128; k++) |
| 16165 | { | ||
| 16166 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 144991232 times.
|
144991232 | if(!p_getc(&(temp_mapscr->secretcset[k]),f)) |
| 16167 | { | ||
| 16168 | ✗ | return qe_invalid; | |
| 16169 | } | ||
| 16170 | 144991232 | } | |
| 16171 | |||
| 16172 |
2/2✓ Branch 0 taken 144991232 times.
✓ Branch 1 taken 1132744 times.
|
146123976 | for(int32_t k=0; k<128; k++) |
| 16173 | { | ||
| 16174 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 144991232 times.
|
144991232 | if(!p_getc(&(temp_mapscr->secretflag[k]),f)) |
| 16175 | { | ||
| 16176 | ✗ | return qe_invalid; | |
| 16177 | } | ||
| 16178 | 144991232 | } | |
| 16179 | 1132744 | } | |
| 16180 | |||
| 16181 |
4/6✓ Branch 0 taken 2720 times.
✓ Branch 1 taken 1152200 times.
✓ Branch 2 taken 2720 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 2720 times.
✗ Branch 5 not taken.
|
1154920 | if((Header->zelda_version == 0x192)&&(Header->build>97)&&(Header->build<154)) |
| 16182 | { | ||
| 16183 | ✗ | if(!p_getc(&padding,f)) | |
| 16184 | { | ||
| 16185 | ✗ | return qe_invalid; | |
| 16186 | } | ||
| 16187 | ✗ | } | |
| 16188 | |||
| 16189 |
2/2✓ Branch 0 taken 203265920 times.
✓ Branch 1 taken 1154920 times.
|
204420840 | for(int32_t k=0; k<176; k++) |
| 16190 | { | ||
| 16191 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 203265920 times.
|
203265920 | if(!p_igetw(&(temp_mapscr->data[k]),f)) |
| 16192 | { | ||
| 16193 | ✗ | return qe_invalid; | |
| 16194 | } | ||
| 16195 | 203265920 | } | |
| 16196 | |||
| 16197 |
4/6✓ Branch 0 taken 2720 times.
✓ Branch 1 taken 1152200 times.
✓ Branch 2 taken 2720 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 2720 times.
✗ Branch 5 not taken.
|
1154920 | if((Header->zelda_version == 0x192)&&(Header->build>20)&&(Header->build<24)) |
| 16198 | { | ||
| 16199 | ✗ | if(!p_getc(&padding,f)) | |
| 16200 | { | ||
| 16201 | ✗ | return qe_invalid; | |
| 16202 | } | ||
| 16203 | |||
| 16204 | ✗ | if(!p_getc(&padding,f)) | |
| 16205 | { | ||
| 16206 | ✗ | return qe_invalid; | |
| 16207 | } | ||
| 16208 | ✗ | } | |
| 16209 | |||
| 16210 |
5/6✓ Branch 0 taken 24896 times.
✓ Branch 1 taken 1130024 times.
✓ Branch 2 taken 2720 times.
✓ Branch 3 taken 22176 times.
✓ Branch 4 taken 2720 times.
✗ Branch 5 not taken.
|
1154920 | if((Header->zelda_version > 0x192)||((Header->zelda_version == 0x192)&&(Header->build>20))) |
| 16211 | { | ||
| 16212 |
2/2✓ Branch 0 taken 199362944 times.
✓ Branch 1 taken 1132744 times.
|
200495688 | for(int32_t k=0; k<176; k++) |
| 16213 | { | ||
| 16214 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 199362944 times.
|
199362944 | if(!p_getc(&(temp_mapscr->sflag[k]),f)) |
| 16215 | { | ||
| 16216 | ✗ | return qe_invalid; | |
| 16217 | } | ||
| 16218 | |||
| 16219 |
3/4✓ Branch 0 taken 478720 times.
✓ Branch 1 taken 198884224 times.
✓ Branch 2 taken 478720 times.
✗ Branch 3 not taken.
|
199362944 | if((Header->zelda_version == 0x192)&&(Header->build<24)) |
| 16220 | { | ||
| 16221 | ✗ | if(!p_getc(&tempbyte,f)) | |
| 16222 | { | ||
| 16223 | ✗ | return qe_invalid; | |
| 16224 | } | ||
| 16225 | |||
| 16226 | ✗ | if(!p_getc(&tempbyte,f)) | |
| 16227 | { | ||
| 16228 | ✗ | return qe_invalid; | |
| 16229 | } | ||
| 16230 | |||
| 16231 | ✗ | if(!p_getc(&tempbyte,f)) | |
| 16232 | { | ||
| 16233 | ✗ | return qe_invalid; | |
| 16234 | } | ||
| 16235 | ✗ | } | |
| 16236 | 199362944 | } | |
| 16237 | 1132744 | } | |
| 16238 | |||
| 16239 |
5/6✓ Branch 0 taken 24896 times.
✓ Branch 1 taken 1130024 times.
✓ Branch 2 taken 2720 times.
✓ Branch 3 taken 22176 times.
✓ Branch 4 taken 2720 times.
✗ Branch 5 not taken.
|
1154920 | if((Header->zelda_version > 0x192)||((Header->zelda_version == 0x192)&&(Header->build>97))) |
| 16240 | { | ||
| 16241 |
2/2✓ Branch 0 taken 1132744 times.
✓ Branch 1 taken 199362944 times.
|
200495688 | for(int32_t k=0; k<176; k++) |
| 16242 | { | ||
| 16243 | |||
| 16244 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 199362944 times.
|
199362944 | if(!p_getc(&(temp_mapscr->cset[k]),f)) |
| 16245 | { | ||
| 16246 | ✗ | return qe_invalid; | |
| 16247 | } | ||
| 16248 | 199362944 | } | |
| 16249 | 1132744 | } | |
| 16250 | |||
| 16251 |
5/6✓ Branch 0 taken 1132744 times.
✓ Branch 1 taken 22176 times.
✓ Branch 2 taken 2720 times.
✓ Branch 3 taken 1130024 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 2720 times.
|
1154920 | if((Header->zelda_version < 0x192)||((Header->zelda_version == 0x192)&&(Header->build<154))) |
| 16252 | { | ||
| 16253 | 22176 | temp_mapscr->undercset=(temp_mapscr->undercombo>>8)&7; | |
| 16254 | 22176 | temp_mapscr->undercombo=(temp_mapscr->undercombo&0xFF)+(temp_mapscr->old_cpage<<8); | |
| 16255 | 22176 | } | |
| 16256 | |||
| 16257 |
5/6✓ Branch 0 taken 1132744 times.
✓ Branch 1 taken 22176 times.
✓ Branch 2 taken 2720 times.
✓ Branch 3 taken 1130024 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 2720 times.
|
1154920 | if((Header->zelda_version < 0x192)||((Header->zelda_version == 0x192)&&(Header->build<137))) |
| 16258 | { | ||
| 16259 | 22176 | temp_mapscr->secretcombo[sSBOMB]=temp_mapscr->secretcombo[sBOMB]; | |
| 16260 | 22176 | temp_mapscr->secretcombo[sRCANDLE]=temp_mapscr->secretcombo[sBCANDLE]; | |
| 16261 | 22176 | temp_mapscr->secretcombo[sWANDFIRE]=temp_mapscr->secretcombo[sBCANDLE]; | |
| 16262 | 22176 | temp_mapscr->secretcombo[sDIVINEFIRE]=temp_mapscr->secretcombo[sBCANDLE]; | |
| 16263 | 22176 | temp_mapscr->secretcombo[sSARROW]=temp_mapscr->secretcombo[sARROW]; | |
| 16264 | 22176 | temp_mapscr->secretcombo[sGARROW]=temp_mapscr->secretcombo[sARROW]; | |
| 16265 | 22176 | } | |
| 16266 | |||
| 16267 |
5/6✓ Branch 0 taken 1132744 times.
✓ Branch 1 taken 22176 times.
✓ Branch 2 taken 2720 times.
✓ Branch 3 taken 1130024 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 2720 times.
|
1154920 | if((Header->zelda_version < 0x192)||((Header->zelda_version == 0x192)&&(Header->build<154))) |
| 16268 | { | ||
| 16269 |
2/2✓ Branch 0 taken 3902976 times.
✓ Branch 1 taken 22176 times.
|
3925152 | for(int32_t k=0; k<176; k++) |
| 16270 | { | ||
| 16271 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 3902976 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
3902976 | if((Header->zelda_version == 0x192)&&(Header->build>149)) |
| 16272 | { | ||
| 16273 | ✗ | if((Header->zelda_version == 0x192)&&(Header->build!=153)) | |
| 16274 | { | ||
| 16275 | ✗ | temp_mapscr->cset[k]=((temp_mapscr->data[k]>>8)&7); | |
| 16276 | ✗ | } | |
| 16277 | ✗ | } | |
| 16278 | else | ||
| 16279 | { | ||
| 16280 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 3902976 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
3902976 | if((Header->zelda_version < 0x192)|| |
| 16281 | ✗ | ((Header->zelda_version == 0x192)&&(Header->build<21))) | |
| 16282 | { | ||
| 16283 | 3902976 | temp_mapscr->sflag[k]=(temp_mapscr->data[k]>>11); | |
| 16284 | 3902976 | } | |
| 16285 | |||
| 16286 | 3902976 | temp_mapscr->cset[k]=((temp_mapscr->data[k]>>8)&7); | |
| 16287 | } | ||
| 16288 | |||
| 16289 | 3902976 | temp_mapscr->data[k]=(temp_mapscr->data[k]&0xFF)+(temp_mapscr->old_cpage<<8); | |
| 16290 | 3902976 | } | |
| 16291 | 22176 | } | |
| 16292 | |||
| 16293 | /*if(version>12) | ||
| 16294 | { | ||
| 16295 | if(!p_getc(&(temp_mapscr->scrWidth),f)) | ||
| 16296 | { | ||
| 16297 | return qe_invalid; | ||
| 16298 | } | ||
| 16299 | if(!p_getc(&(temp_mapscr->scrHeight),f)) | ||
| 16300 | { | ||
| 16301 | return qe_invalid; | ||
| 16302 | } | ||
| 16303 | }*/ | ||
| 16304 | |||
| 16305 |
2/2✓ Branch 0 taken 626416 times.
✓ Branch 1 taken 528504 times.
|
1154920 | if(version>4) |
| 16306 | { | ||
| 16307 |
1/2✓ Branch 0 taken 626416 times.
✗ Branch 1 not taken.
|
626416 | if(!p_igetw(&(temp_mapscr->screen_midi),f)) |
| 16308 | { | ||
| 16309 | ✗ | return qe_invalid; | |
| 16310 | } | ||
| 16311 | 626416 | } | |
| 16312 | else | ||
| 16313 | { | ||
| 16314 | 528504 | temp_mapscr->screen_midi = -1; | |
| 16315 | } | ||
| 16316 | |||
| 16317 |
2/2✓ Branch 0 taken 626416 times.
✓ Branch 1 taken 528504 times.
|
1154920 | if(version>=17) |
| 16318 | { | ||
| 16319 |
1/2✓ Branch 0 taken 626416 times.
✗ Branch 1 not taken.
|
626416 | if(!p_getc(&(temp_mapscr->lens_layer),f)) |
| 16320 | { | ||
| 16321 | ✗ | return qe_invalid; | |
| 16322 | } | ||
| 16323 | 626416 | } | |
| 16324 | else | ||
| 16325 | { | ||
| 16326 | 528504 | temp_mapscr->lens_layer = llNORMAL; | |
| 16327 | } | ||
| 16328 | |||
| 16329 |
2/2✓ Branch 0 taken 528504 times.
✓ Branch 1 taken 626416 times.
|
1154920 | if(version>6) |
| 16330 | { | ||
| 16331 | dword bits; | ||
| 16332 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 626416 times.
|
626416 | if(!p_igetl(&bits,f)) |
| 16333 | { | ||
| 16334 | ✗ | return qe_invalid; | |
| 16335 | } | ||
| 16336 | |||
| 16337 | int32_t m; | ||
| 16338 | float tempfloat; | ||
| 16339 | word tempw; | ||
| 16340 | 626416 | temp_mapscr->ffcCountMarkDirty(); | |
| 16341 | |||
| 16342 |
2/2✓ Branch 0 taken 626416 times.
✓ Branch 1 taken 20045312 times.
|
20671728 | for(m=0; m<32; m++) |
| 16343 | { | ||
| 16344 | 20045312 | ffcdata& tempffc = temp_mapscr->ffcs[m]; | |
| 16345 | 20045312 | tempffc.clear(); | |
| 16346 |
2/2✓ Branch 0 taken 19785588 times.
✓ Branch 1 taken 259724 times.
|
20045312 | if((bits>>m)&1) |
| 16347 | { | ||
| 16348 |
1/2✓ Branch 0 taken 259724 times.
✗ Branch 1 not taken.
|
259724 | if(!p_igetw(&tempw,f)) |
| 16349 | { | ||
| 16350 | ✗ | return qe_invalid; | |
| 16351 | } | ||
| 16352 | 259724 | tempffc.data = tempw; | |
| 16353 | |||
| 16354 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 259724 times.
|
259724 | if(!p_getc(&(tempffc.cset),f)) |
| 16355 | { | ||
| 16356 | ✗ | return qe_invalid; | |
| 16357 | } | ||
| 16358 | |||
| 16359 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 259724 times.
|
259724 | if(!p_igetw(&(tempffc.delay),f)) |
| 16360 | { | ||
| 16361 | ✗ | return qe_invalid; | |
| 16362 | } | ||
| 16363 | |||
| 16364 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 259724 times.
|
259724 | if(version < 9) |
| 16365 | { | ||
| 16366 | ✗ | if(!p_igetf_DO_NOT_USE(&tempfloat,f)) | |
| 16367 | { | ||
| 16368 | ✗ | return qe_invalid; | |
| 16369 | } | ||
| 16370 | |||
| 16371 | ✗ | tempffc.x=zslongToFix(int32_t(tempfloat*10000)); | |
| 16372 | |||
| 16373 | ✗ | if(!p_igetf_DO_NOT_USE(&tempfloat,f)) | |
| 16374 | { | ||
| 16375 | ✗ | return qe_invalid; | |
| 16376 | } | ||
| 16377 | |||
| 16378 | ✗ | tempffc.y=zslongToFix(int32_t(tempfloat*10000)); | |
| 16379 | |||
| 16380 | ✗ | if(!p_igetf_DO_NOT_USE(&tempfloat,f)) | |
| 16381 | { | ||
| 16382 | ✗ | return qe_invalid; | |
| 16383 | } | ||
| 16384 | |||
| 16385 | ✗ | tempffc.vx=zslongToFix(int32_t(tempfloat*10000)); | |
| 16386 | |||
| 16387 | ✗ | if(!p_igetf_DO_NOT_USE(&tempfloat,f)) | |
| 16388 | { | ||
| 16389 | ✗ | return qe_invalid; | |
| 16390 | } | ||
| 16391 | |||
| 16392 | ✗ | tempffc.vy=zslongToFix(int32_t(tempfloat*10000)); | |
| 16393 | |||
| 16394 | ✗ | if(!p_igetf_DO_NOT_USE(&tempfloat,f)) | |
| 16395 | { | ||
| 16396 | ✗ | return qe_invalid; | |
| 16397 | } | ||
| 16398 | |||
| 16399 | ✗ | tempffc.ax=zslongToFix(int32_t(tempfloat*10000)); | |
| 16400 | |||
| 16401 | ✗ | if(!p_igetf_DO_NOT_USE(&tempfloat,f)) | |
| 16402 | { | ||
| 16403 | ✗ | return qe_invalid; | |
| 16404 | } | ||
| 16405 | |||
| 16406 | ✗ | tempffc.ay=zslongToFix(int32_t(tempfloat*10000)); | |
| 16407 | ✗ | } | |
| 16408 | else | ||
| 16409 | { | ||
| 16410 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 259724 times.
|
259724 | if(!p_igetzf(&(tempffc.x),f)) |
| 16411 | { | ||
| 16412 | ✗ | return qe_invalid; | |
| 16413 | } | ||
| 16414 | |||
| 16415 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 259724 times.
|
259724 | if(!p_igetzf(&(tempffc.y),f)) |
| 16416 | { | ||
| 16417 | ✗ | return qe_invalid; | |
| 16418 | } | ||
| 16419 | |||
| 16420 |
1/2✓ Branch 0 taken 259724 times.
✗ Branch 1 not taken.
|
259724 | if(!p_igetzf(&(tempffc.vx),f)) |
| 16421 | { | ||
| 16422 | ✗ | return qe_invalid; | |
| 16423 | } | ||
| 16424 | |||
| 16425 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 259724 times.
|
259724 | if(!p_igetzf(&(tempffc.vy),f)) |
| 16426 | { | ||
| 16427 | ✗ | return qe_invalid; | |
| 16428 | } | ||
| 16429 | |||
| 16430 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 259724 times.
|
259724 | if(!p_igetzf(&(tempffc.ax),f)) |
| 16431 | { | ||
| 16432 | ✗ | return qe_invalid; | |
| 16433 | } | ||
| 16434 | |||
| 16435 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 259724 times.
|
259724 | if(!p_igetzf(&(tempffc.ay),f)) |
| 16436 | { | ||
| 16437 | ✗ | return qe_invalid; | |
| 16438 | } | ||
| 16439 | } | ||
| 16440 | |||
| 16441 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 259724 times.
|
259724 | if(!p_getc(&(tempffc.link),f)) |
| 16442 | { | ||
| 16443 | ✗ | return qe_invalid; | |
| 16444 | } | ||
| 16445 | |||
| 16446 |
1/2✓ Branch 0 taken 259724 times.
✗ Branch 1 not taken.
|
259724 | if(version>7) |
| 16447 | { | ||
| 16448 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 259724 times.
|
259724 | if(!p_getc(&tempbyte,f)) |
| 16449 | { | ||
| 16450 | ✗ | return qe_invalid; | |
| 16451 | } | ||
| 16452 | |||
| 16453 | 259724 | tempffc.hit_width = (tempbyte&0x3F)+1; | |
| 16454 | 259724 | tempffc.txsz = (tempbyte>>6)+1; | |
| 16455 | |||
| 16456 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 259724 times.
|
259724 | if(!p_getc(&tempbyte,f)) |
| 16457 | { | ||
| 16458 | ✗ | return qe_invalid; | |
| 16459 | } | ||
| 16460 | |||
| 16461 | 259724 | tempffc.hit_height = (tempbyte&0x3F)+1; | |
| 16462 | 259724 | tempffc.tysz = (tempbyte>>6)+1; | |
| 16463 | |||
| 16464 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 259724 times.
|
259724 | if(!p_igetl(&(tempffc.flags),f)) |
| 16465 | { | ||
| 16466 | ✗ | return qe_invalid; | |
| 16467 | } | ||
| 16468 | 259724 | } | |
| 16469 | else | ||
| 16470 | { | ||
| 16471 | ✗ | tempffc.hit_width=16; | |
| 16472 | ✗ | tempffc.hit_height=16; | |
| 16473 | ✗ | tempffc.txsz=1; | |
| 16474 | ✗ | tempffc.tysz=1; | |
| 16475 | ✗ | tempffc.flags=0; | |
| 16476 | } | ||
| 16477 | |||
| 16478 | 259724 | tempffc.updateSolid(); | |
| 16479 | |||
| 16480 | |||
| 16481 |
4/6✓ Branch 0 taken 259724 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 253720 times.
✓ Branch 3 taken 6004 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 253720 times.
|
259724 | if(Header->zelda_version == 0x211 || (Header->zelda_version == 0x250 && Header->build<20)) |
| 16482 | { | ||
| 16483 | ✗ | tempffc.flags|=ffIGNOREHOLDUP; | |
| 16484 | ✗ | } | |
| 16485 | |||
| 16486 |
1/2✓ Branch 0 taken 259724 times.
✗ Branch 1 not taken.
|
259724 | if(version>9) |
| 16487 | { | ||
| 16488 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 259724 times.
|
259724 | if(!p_igetw(&(tempffc.script),f)) |
| 16489 | { | ||
| 16490 | ✗ | return qe_invalid; | |
| 16491 | } | ||
| 16492 | 259724 | } | |
| 16493 | else | ||
| 16494 | { | ||
| 16495 | ✗ | tempffc.script=0; | |
| 16496 | } | ||
| 16497 | |||
| 16498 |
1/2✓ Branch 0 taken 259724 times.
✗ Branch 1 not taken.
|
259724 | if(version>10) |
| 16499 | { | ||
| 16500 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 259724 times.
|
259724 | if(!p_igetl(&(tempffc.initd[0]),f)) |
| 16501 | { | ||
| 16502 | ✗ | return qe_invalid; | |
| 16503 | } | ||
| 16504 | |||
| 16505 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 259724 times.
|
259724 | if(!p_igetl(&(tempffc.initd[1]),f)) |
| 16506 | { | ||
| 16507 | ✗ | return qe_invalid; | |
| 16508 | } | ||
| 16509 | |||
| 16510 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 259724 times.
|
259724 | if(!p_igetl(&(tempffc.initd[2]),f)) |
| 16511 | { | ||
| 16512 | ✗ | return qe_invalid; | |
| 16513 | } | ||
| 16514 | |||
| 16515 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 259724 times.
|
259724 | if(!p_igetl(&(tempffc.initd[3]),f)) |
| 16516 | { | ||
| 16517 | ✗ | return qe_invalid; | |
| 16518 | } | ||
| 16519 | |||
| 16520 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 259724 times.
|
259724 | if(!p_igetl(&(tempffc.initd[4]),f)) |
| 16521 | { | ||
| 16522 | ✗ | return qe_invalid; | |
| 16523 | } | ||
| 16524 | |||
| 16525 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 259724 times.
|
259724 | if(!p_igetl(&(tempffc.initd[5]),f)) |
| 16526 | { | ||
| 16527 | ✗ | return qe_invalid; | |
| 16528 | } | ||
| 16529 | |||
| 16530 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 259724 times.
|
259724 | if(!p_igetl(&(tempffc.initd[6]),f)) |
| 16531 | { | ||
| 16532 | ✗ | return qe_invalid; | |
| 16533 | } | ||
| 16534 | |||
| 16535 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 259724 times.
|
259724 | if(!p_igetl(&(tempffc.initd[7]),f)) |
| 16536 | { | ||
| 16537 | ✗ | return qe_invalid; | |
| 16538 | } | ||
| 16539 | |||
| 16540 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 259724 times.
|
259724 | if(!p_getc(&(tempbyte),f)) |
| 16541 | { | ||
| 16542 | ✗ | return qe_invalid; | |
| 16543 | } | ||
| 16544 | |||
| 16545 | 259724 | tempffc.inita[0]=tempbyte*10000; | |
| 16546 | |||
| 16547 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 259724 times.
|
259724 | if(!p_getc(&(tempbyte),f)) |
| 16548 | { | ||
| 16549 | ✗ | return qe_invalid; | |
| 16550 | } | ||
| 16551 | |||
| 16552 | 259724 | tempffc.inita[1]=tempbyte*10000; | |
| 16553 | 259724 | } | |
| 16554 | else | ||
| 16555 | { | ||
| 16556 | ✗ | tempffc.inita[0] = 10000; | |
| 16557 | ✗ | tempffc.inita[1] = 10000; | |
| 16558 | } | ||
| 16559 | |||
| 16560 |
1/2✓ Branch 0 taken 259724 times.
✗ Branch 1 not taken.
|
259724 | if(loading_tileset_flags & TILESET_CLEARSCRIPTS) |
| 16561 | { | ||
| 16562 | ✗ | tempffc.script = 0; | |
| 16563 | ✗ | for(int q = 0; q < 8; ++q) | |
| 16564 | ✗ | tempffc.initd[q] = 0; | |
| 16565 | ✗ | } | |
| 16566 |
1/2✓ Branch 0 taken 259724 times.
✗ Branch 1 not taken.
|
259724 | if(version <= 11) |
| 16567 | { | ||
| 16568 | ✗ | fixffcs=true; | |
| 16569 | ✗ | } | |
| 16570 | 259724 | } | |
| 16571 | 20045312 | } | |
| 16572 |
2/2✓ Branch 0 taken 60135936 times.
✓ Branch 1 taken 626416 times.
|
60762352 | for(m = 32; m < MAXFFCS; ++m) |
| 16573 | { | ||
| 16574 | 60135936 | temp_mapscr->ffcs[m].clear(); | |
| 16575 | 60135936 | } | |
| 16576 | 626416 | } | |
| 16577 | |||
| 16578 | //add in the new whistle flags | ||
| 16579 |
2/2✓ Branch 0 taken 626416 times.
✓ Branch 1 taken 528504 times.
|
1154920 | if(version<13) |
| 16580 | { | ||
| 16581 |
2/2✓ Branch 0 taken 124 times.
✓ Branch 1 taken 528380 times.
|
528504 | if(temp_mapscr->flags & fWHISTLE) |
| 16582 | { | ||
| 16583 | 124 | temp_mapscr->flags7 |= (fWHISTLEPAL | fWHISTLEWATER); | |
| 16584 | 124 | } | |
| 16585 | 528504 | } | |
| 16586 | |||
| 16587 | //2.55 starts here | ||
| 16588 |
3/4✓ Branch 0 taken 34408 times.
✓ Branch 1 taken 1120512 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 34408 times.
|
1154920 | if ( version >= 19 && Header->zelda_version > 0x253 ) |
| 16589 | { | ||
| 16590 |
2/2✓ Branch 0 taken 344080 times.
✓ Branch 1 taken 34408 times.
|
378488 | for ( int32_t q = 0; q < 10; q++ ) |
| 16591 | { | ||
| 16592 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 344080 times.
|
344080 | if(!p_igetl(&(temp_mapscr->npcstrings[q]),f)) |
| 16593 | { | ||
| 16594 | ✗ | return qe_invalid; | |
| 16595 | } | ||
| 16596 | 344080 | } | |
| 16597 |
2/2✓ Branch 0 taken 344080 times.
✓ Branch 1 taken 34408 times.
|
378488 | for ( int32_t q = 0; q < 10; q++ ) |
| 16598 | { | ||
| 16599 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 344080 times.
|
344080 | if(!p_igetw(&(temp_mapscr->new_items[q]),f)) |
| 16600 | { | ||
| 16601 | ✗ | return qe_invalid; | |
| 16602 | } | ||
| 16603 | 344080 | } | |
| 16604 |
2/2✓ Branch 0 taken 344080 times.
✓ Branch 1 taken 34408 times.
|
378488 | for ( int32_t q = 0; q < 10; q++ ) |
| 16605 | { | ||
| 16606 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 344080 times.
|
344080 | if(!p_igetw(&(temp_mapscr->new_item_x[q]),f)) |
| 16607 | { | ||
| 16608 | ✗ | return qe_invalid; | |
| 16609 | } | ||
| 16610 | 344080 | } | |
| 16611 |
2/2✓ Branch 0 taken 34408 times.
✓ Branch 1 taken 344080 times.
|
378488 | for ( int32_t q = 0; q < 10; q++ ) |
| 16612 | { | ||
| 16613 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 344080 times.
|
344080 | if(!p_igetw(&(temp_mapscr->new_item_y[q]),f)) |
| 16614 | { | ||
| 16615 | ✗ | return qe_invalid; | |
| 16616 | } | ||
| 16617 | 344080 | } | |
| 16618 | 34408 | } | |
| 16619 |
3/4✓ Branch 0 taken 1120512 times.
✓ Branch 1 taken 34408 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 1120512 times.
|
1154920 | if ( version < 19 && Header->zelda_version > 0x253 ) |
| 16620 | { | ||
| 16621 | ✗ | for ( int32_t q = 0; q < 10; q++ ) | |
| 16622 | { | ||
| 16623 | ✗ | temp_mapscr->npcstrings[q] = 0; | |
| 16624 | ✗ | temp_mapscr->new_items[q] = 0; | |
| 16625 | ✗ | temp_mapscr->new_item_x[q] = 0; | |
| 16626 | ✗ | temp_mapscr->new_item_y[q] = 0; | |
| 16627 | ✗ | } | |
| 16628 | ✗ | } | |
| 16629 |
3/4✓ Branch 0 taken 34408 times.
✓ Branch 1 taken 1120512 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 34408 times.
|
1154920 | if ( version >= 20 && Header->zelda_version > 0x253 ) |
| 16630 | { | ||
| 16631 |
1/2✓ Branch 0 taken 34408 times.
✗ Branch 1 not taken.
|
34408 | if(!p_igetw(&(temp_mapscr->script),f)) |
| 16632 | { | ||
| 16633 | ✗ | return qe_invalid; | |
| 16634 | } | ||
| 16635 |
2/2✓ Branch 0 taken 275264 times.
✓ Branch 1 taken 34408 times.
|
309672 | for ( int32_t q = 0; q < 8; q++) |
| 16636 | { | ||
| 16637 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 275264 times.
|
275264 | if(!p_igetl(&(temp_mapscr->screeninitd[q]),f)) |
| 16638 | { | ||
| 16639 | ✗ | return qe_invalid; | |
| 16640 | } | ||
| 16641 | 275264 | } | |
| 16642 | 34408 | } | |
| 16643 |
2/2✓ Branch 0 taken 34408 times.
✓ Branch 1 taken 1120512 times.
|
1154920 | if ( version < 20 ) |
| 16644 | { | ||
| 16645 | 1120512 | temp_mapscr->script = 0; | |
| 16646 |
2/2✓ Branch 0 taken 8964096 times.
✓ Branch 1 taken 1120512 times.
|
10084608 | for ( int32_t q = 0; q < 8; q++) temp_mapscr->screeninitd[q] = 0; |
| 16647 | 1120512 | } | |
| 16648 |
3/4✓ Branch 0 taken 34408 times.
✓ Branch 1 taken 1120512 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 34408 times.
|
1154920 | if ( version >= 21 && Header->zelda_version > 0x253 ) |
| 16649 | { | ||
| 16650 |
1/2✓ Branch 0 taken 34408 times.
✗ Branch 1 not taken.
|
34408 | if(!p_getc(&(temp_mapscr->preloadscript),f)) |
| 16651 | { | ||
| 16652 | ✗ | return qe_invalid; | |
| 16653 | } | ||
| 16654 | 34408 | } | |
| 16655 |
2/2✓ Branch 0 taken 1120512 times.
✓ Branch 1 taken 34408 times.
|
1154920 | if ( version < 21 ) |
| 16656 | { | ||
| 16657 | 1120512 | temp_mapscr->preloadscript = 0; | |
| 16658 | 1120512 | } | |
| 16659 | //all builds with version > 20 need this. -Z | ||
| 16660 | |||
| 16661 |
3/4✓ Branch 0 taken 34408 times.
✓ Branch 1 taken 1120512 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 34408 times.
|
1154920 | if ( version >= 22 && Header->zelda_version > 0x253 ) //26th June, 2019; Layer Visibility |
| 16662 | { | ||
| 16663 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 34408 times.
|
34408 | if(!p_getc(&(temp_mapscr->hidelayers ),f)) |
| 16664 | { | ||
| 16665 | ✗ | return qe_invalid; | |
| 16666 | } | ||
| 16667 |
1/2✓ Branch 0 taken 34408 times.
✗ Branch 1 not taken.
|
34408 | if(!p_getc(&(temp_mapscr->hidescriptlayers ),f)) |
| 16668 | { | ||
| 16669 | ✗ | return qe_invalid; | |
| 16670 | } | ||
| 16671 | 34408 | } | |
| 16672 |
2/2✓ Branch 0 taken 1120512 times.
✓ Branch 1 taken 34408 times.
|
1154920 | if ( version < 22 ) |
| 16673 | { | ||
| 16674 | 1120512 | temp_mapscr->hidelayers = 0; | |
| 16675 | 1120512 | temp_mapscr->hidescriptlayers = 0; | |
| 16676 | 1120512 | } | |
| 16677 | |||
| 16678 | //Dodongos in 2.10 used the boss roar, not the dodongo sound. -Z | ||
| 16679 | //May be any version before 2.11. -Z | ||
| 16680 | /* --not the roar, the HIT SFX | ||
| 16681 | if ( Header->zelda_version <= 0x210 ) | ||
| 16682 | { | ||
| 16683 | if ( temp_mapscr->bosssfx == WAV_DODONGO ) | ||
| 16684 | { | ||
| 16685 | temp_mapscr->bosssfx = WAV_ROAR; | ||
| 16686 | } | ||
| 16687 | } | ||
| 16688 | */ | ||
| 16689 |
2/2✓ Branch 0 taken 4619680 times.
✓ Branch 1 taken 1154920 times.
|
5774600 | for(int32_t k=0; k<4; k++) |
| 16690 | { | ||
| 16691 |
1/2✓ Branch 0 taken 4619680 times.
✗ Branch 1 not taken.
|
4619680 | if(temp_mapscr->door[k] == dNONE) |
| 16692 | ✗ | temp_mapscr->door[k] = dWALL; | |
| 16693 | 4619680 | } | |
| 16694 | |||
| 16695 | 1154920 | return 0; | |
| 16696 | 1154920 | } | |
| 16697 | 1331856 | int32_t readmapscreen(PACKFILE *f, zquestheader *Header, mapscr *temp_mapscr, word version, int scrind) | |
| 16698 | { | ||
| 16699 |
2/2✓ Branch 0 taken 1154920 times.
✓ Branch 1 taken 176936 times.
|
1331856 | if(version < 23) |
| 16700 | { | ||
| 16701 | 1154920 | auto ret = readmapscreen_old(f,Header,temp_mapscr,version); | |
| 16702 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1154920 times.
|
1154920 | if(ret) return ret; |
| 16703 | 1154920 | } | |
| 16704 | else | ||
| 16705 | { | ||
| 16706 |
1/2✓ Branch 0 taken 176936 times.
✗ Branch 1 not taken.
|
176936 | if(!p_getc(&(temp_mapscr->valid),f)) |
| 16707 | ✗ | return qe_invalid; | |
| 16708 |
2/2✓ Branch 0 taken 132202 times.
✓ Branch 1 taken 44734 times.
|
176936 | if(!(temp_mapscr->valid & mVALID)) |
| 16709 | { | ||
| 16710 | 132202 | int map = scrind/MAPSCRS; | |
| 16711 | 132202 | int scr = scrind%MAPSCRS; | |
| 16712 |
4/6✓ Branch 0 taken 124840 times.
✓ Branch 1 taken 7362 times.
✓ Branch 2 taken 124840 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 124840 times.
✗ Branch 5 not taken.
|
132202 | if(version > 25 && scrind > -1 && (map*6+5) < map_autolayers.size()) |
| 16713 | { | ||
| 16714 | //Empty screen, apply autolayers | ||
| 16715 |
2/2✓ Branch 0 taken 15156 times.
✓ Branch 1 taken 124840 times.
|
139996 | for(int q = 0; q < 6; ++q) |
| 16716 | { | ||
| 16717 | 15156 | auto layermap = map_autolayers[map*6+q]; | |
| 16718 | 15156 | temp_mapscr->layermap[q] = layermap; | |
| 16719 | 15156 | if(layermap) | |
| 16720 | 15156 | temp_mapscr->layerscreen[q] = scr; | |
| 16721 | 15156 | } | |
| 16722 | 124840 | } | |
| 16723 | 132202 | return 0; | |
| 16724 | } | ||
| 16725 | uint32_t scr_has_flags; | ||
| 16726 |
1/2✓ Branch 0 taken 44734 times.
✗ Branch 1 not taken.
|
44734 | if(!p_igetl(&scr_has_flags,f)) |
| 16727 | ✗ | return qe_invalid; | |
| 16728 | |||
| 16729 |
2/2✓ Branch 0 taken 10470 times.
✓ Branch 1 taken 34264 times.
|
44734 | if(scr_has_flags & SCRHAS_ROOMDATA) |
| 16730 | { | ||
| 16731 |
1/2✓ Branch 0 taken 34264 times.
✗ Branch 1 not taken.
|
34264 | if(!p_getc(&(temp_mapscr->guy),f)) |
| 16732 | ✗ | return qe_invalid; | |
| 16733 |
2/2✓ Branch 0 taken 34144 times.
✓ Branch 1 taken 120 times.
|
34264 | if(version > 26) |
| 16734 | { | ||
| 16735 |
1/2✓ Branch 0 taken 34144 times.
✗ Branch 1 not taken.
|
34144 | if(!p_igetl(&(temp_mapscr->guytile),f)) |
| 16736 | ✗ | return qe_invalid; | |
| 16737 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 34144 times.
|
34144 | if(!p_getc(&(temp_mapscr->guycs),f)) |
| 16738 | ✗ | return qe_invalid; | |
| 16739 |
1/2✓ Branch 0 taken 34144 times.
✗ Branch 1 not taken.
|
34144 | if(!p_igetw(&(temp_mapscr->roomflags),f)) |
| 16740 | ✗ | return qe_invalid; | |
| 16741 | 34144 | } | |
| 16742 | else | ||
| 16743 | { | ||
| 16744 | 120 | temp_mapscr->guytile = -1; //signal to use default guy values | |
| 16745 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 120 times.
|
120 | SETFLAG(temp_mapscr->roomflags,RFL_ALWAYS_GUY,temp_mapscr->guy==gFAIRY); |
| 16746 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 120 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
120 | SETFLAG(temp_mapscr->roomflags,RFL_GUYFIRES,temp_mapscr->guy!=gFAIRY || !get_qr(qr_NOFAIRYGUYFIRES)); |
| 16747 | } | ||
| 16748 |
1/2✓ Branch 0 taken 34264 times.
✗ Branch 1 not taken.
|
34264 | if(!p_igetw(&(temp_mapscr->str),f)) |
| 16749 | ✗ | return qe_invalid; | |
| 16750 |
1/2✓ Branch 0 taken 34264 times.
✗ Branch 1 not taken.
|
34264 | if(!p_getc(&(temp_mapscr->room),f)) |
| 16751 | ✗ | return qe_invalid; | |
| 16752 |
1/2✓ Branch 0 taken 34264 times.
✗ Branch 1 not taken.
|
34264 | if(!p_igetw(&(temp_mapscr->catchall),f)) |
| 16753 | ✗ | return qe_invalid; | |
| 16754 | 34264 | } | |
| 16755 |
2/2✓ Branch 0 taken 42936 times.
✓ Branch 1 taken 1798 times.
|
44734 | if(scr_has_flags & SCRHAS_ITEM) |
| 16756 | { | ||
| 16757 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1798 times.
|
1798 | if(!p_getc(&(temp_mapscr->item),f)) |
| 16758 | ✗ | return qe_invalid; | |
| 16759 |
1/2✓ Branch 0 taken 1798 times.
✗ Branch 1 not taken.
|
1798 | if(!p_getc(&(temp_mapscr->hasitem),f)) |
| 16760 | ✗ | return qe_invalid; | |
| 16761 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1798 times.
|
1798 | if(!p_getc(&(temp_mapscr->itemx),f)) |
| 16762 | ✗ | return qe_invalid; | |
| 16763 |
1/2✓ Branch 0 taken 1798 times.
✗ Branch 1 not taken.
|
1798 | if(!p_getc(&(temp_mapscr->itemy),f)) |
| 16764 | ✗ | return qe_invalid; | |
| 16765 | 1798 | } | |
| 16766 |
2/2✓ Branch 0 taken 36308 times.
✓ Branch 1 taken 8426 times.
|
44734 | if(scr_has_flags & (SCRHAS_SWARP|SCRHAS_TWARP)) |
| 16767 | { | ||
| 16768 |
1/2✓ Branch 0 taken 8426 times.
✗ Branch 1 not taken.
|
8426 | if(!p_igetw(&temp_mapscr->warpreturnc,f)) |
| 16769 | ✗ | return qe_invalid; | |
| 16770 | 8426 | } | |
| 16771 |
2/2✓ Branch 0 taken 42640 times.
✓ Branch 1 taken 2094 times.
|
44734 | if(scr_has_flags & SCRHAS_TWARP) |
| 16772 | { | ||
| 16773 |
2/2✓ Branch 0 taken 8376 times.
✓ Branch 1 taken 2094 times.
|
10470 | for(int32_t i=0; i<4; i++) |
| 16774 | { | ||
| 16775 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 8376 times.
|
8376 | if(!p_getc(&(temp_mapscr->tilewarptype[i]),f)) |
| 16776 | ✗ | return qe_invalid; | |
| 16777 | 8376 | } | |
| 16778 |
2/2✓ Branch 0 taken 8376 times.
✓ Branch 1 taken 2094 times.
|
10470 | for(int32_t i=0; i<4; i++) |
| 16779 | { | ||
| 16780 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 8376 times.
|
8376 | if(!p_igetw(&(temp_mapscr->tilewarpdmap[i]),f)) |
| 16781 | ✗ | return qe_invalid; | |
| 16782 | 8376 | } | |
| 16783 |
2/2✓ Branch 0 taken 8376 times.
✓ Branch 1 taken 2094 times.
|
10470 | for(int32_t i=0; i<4; i++) |
| 16784 | { | ||
| 16785 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 8376 times.
|
8376 | if(!p_getc(&(temp_mapscr->tilewarpscr[i]),f)) |
| 16786 | ✗ | return qe_invalid; | |
| 16787 | 8376 | } | |
| 16788 |
1/2✓ Branch 0 taken 2094 times.
✗ Branch 1 not taken.
|
2094 | if(!p_getc(&(temp_mapscr->tilewarpoverlayflags),f)) |
| 16789 | ✗ | return qe_invalid; | |
| 16790 | 2094 | } | |
| 16791 |
2/2✓ Branch 0 taken 37970 times.
✓ Branch 1 taken 6764 times.
|
44734 | if(scr_has_flags & SCRHAS_SWARP) |
| 16792 | { | ||
| 16793 |
2/2✓ Branch 0 taken 27056 times.
✓ Branch 1 taken 6764 times.
|
33820 | for(int32_t i=0; i<4; i++) |
| 16794 | { | ||
| 16795 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 27056 times.
|
27056 | if(!p_getc(&(temp_mapscr->sidewarptype[i]),f)) |
| 16796 | ✗ | return qe_invalid; | |
| 16797 | 27056 | } | |
| 16798 |
2/2✓ Branch 0 taken 27056 times.
✓ Branch 1 taken 6764 times.
|
33820 | for(int32_t i=0; i<4; i++) |
| 16799 | { | ||
| 16800 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 27056 times.
|
27056 | if(!p_igetw(&(temp_mapscr->sidewarpdmap[i]),f)) |
| 16801 | ✗ | return qe_invalid; | |
| 16802 | 27056 | } | |
| 16803 |
2/2✓ Branch 0 taken 27056 times.
✓ Branch 1 taken 6764 times.
|
33820 | for(int32_t i=0; i<4; i++) |
| 16804 | { | ||
| 16805 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 27056 times.
|
27056 | if(!p_getc(&(temp_mapscr->sidewarpscr[i]),f)) |
| 16806 | ✗ | return qe_invalid; | |
| 16807 | 27056 | } | |
| 16808 |
1/2✓ Branch 0 taken 6764 times.
✗ Branch 1 not taken.
|
6764 | if(!p_getc(&(temp_mapscr->sidewarpoverlayflags),f)) |
| 16809 | ✗ | return qe_invalid; | |
| 16810 |
1/2✓ Branch 0 taken 6764 times.
✗ Branch 1 not taken.
|
6764 | if(!p_getc(&(temp_mapscr->sidewarpindex),f)) |
| 16811 | ✗ | return qe_invalid; | |
| 16812 | 6764 | } | |
| 16813 |
2/2✓ Branch 0 taken 39946 times.
✓ Branch 1 taken 4788 times.
|
44734 | if(scr_has_flags & SCRHAS_WARPRET) |
| 16814 | { | ||
| 16815 |
2/2✓ Branch 0 taken 19152 times.
✓ Branch 1 taken 4788 times.
|
23940 | for(int32_t i=0; i<4; i++) |
| 16816 | { | ||
| 16817 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 19152 times.
|
19152 | if(!p_getc(&(temp_mapscr->warpreturnx[i]),f)) |
| 16818 | ✗ | return qe_invalid; | |
| 16819 | 19152 | } | |
| 16820 |
2/2✓ Branch 0 taken 19152 times.
✓ Branch 1 taken 4788 times.
|
23940 | for(int32_t i=0; i<4; i++) |
| 16821 | { | ||
| 16822 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 19152 times.
|
19152 | if(!p_getc(&(temp_mapscr->warpreturny[i]),f)) |
| 16823 | ✗ | return qe_invalid; | |
| 16824 | 19152 | } | |
| 16825 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4788 times.
|
4788 | if(!p_getc(&(temp_mapscr->warparrivalx),f)) |
| 16826 | ✗ | return qe_invalid; | |
| 16827 |
1/2✓ Branch 0 taken 4788 times.
✗ Branch 1 not taken.
|
4788 | if(!p_getc(&(temp_mapscr->warparrivaly),f)) |
| 16828 | ✗ | return qe_invalid; | |
| 16829 | 4788 | } | |
| 16830 |
2/2✓ Branch 0 taken 34102 times.
✓ Branch 1 taken 10632 times.
|
44734 | if(scr_has_flags & SCRHAS_LAYERS) |
| 16831 | { | ||
| 16832 |
2/2✓ Branch 0 taken 63792 times.
✓ Branch 1 taken 10632 times.
|
74424 | for(int32_t k=0; k<6; k++) |
| 16833 | { | ||
| 16834 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 63792 times.
|
63792 | if(!p_getc(&(temp_mapscr->layermap[k]),f)) |
| 16835 | ✗ | return qe_invalid; | |
| 16836 | 63792 | } | |
| 16837 |
2/2✓ Branch 0 taken 63792 times.
✓ Branch 1 taken 10632 times.
|
74424 | for(int32_t k=0; k<6; k++) |
| 16838 | { | ||
| 16839 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 63792 times.
|
63792 | if(!p_getc(&(temp_mapscr->layerscreen[k]),f)) |
| 16840 | ✗ | return qe_invalid; | |
| 16841 | 63792 | } | |
| 16842 |
2/2✓ Branch 0 taken 63792 times.
✓ Branch 1 taken 10632 times.
|
74424 | for(int32_t k=0; k<6; k++) |
| 16843 | { | ||
| 16844 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 63792 times.
|
63792 | if(!p_getc(&(temp_mapscr->layeropacity[k]),f)) |
| 16845 | ✗ | return qe_invalid; | |
| 16846 | 63792 | } | |
| 16847 |
1/2✓ Branch 0 taken 10632 times.
✗ Branch 1 not taken.
|
10632 | if(!p_getc(&(temp_mapscr->hidelayers),f)) |
| 16848 | ✗ | return qe_invalid; | |
| 16849 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 10632 times.
|
10632 | if(!p_getc(&(temp_mapscr->hidescriptlayers),f)) |
| 16850 | ✗ | return qe_invalid; | |
| 16851 | 10632 | } | |
| 16852 |
2/2✓ Branch 0 taken 44732 times.
✓ Branch 1 taken 2 times.
|
44734 | if(scr_has_flags & SCRHAS_MAZE) |
| 16853 | { | ||
| 16854 |
2/2✓ Branch 0 taken 8 times.
✓ Branch 1 taken 2 times.
|
10 | for(int32_t k=0; k<4; k++) |
| 16855 | { | ||
| 16856 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 8 times.
|
8 | if(!p_getc(&(temp_mapscr->path[k]),f)) |
| 16857 | ✗ | return qe_invalid; | |
| 16858 | 8 | } | |
| 16859 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2 times.
|
2 | if(!p_getc(&(temp_mapscr->exitdir),f)) |
| 16860 | ✗ | return qe_invalid; | |
| 16861 | 2 | } | |
| 16862 |
2/2✓ Branch 0 taken 20128 times.
✓ Branch 1 taken 24606 times.
|
44734 | if(scr_has_flags & SCRHAS_D_S_U) |
| 16863 | { | ||
| 16864 |
1/2✓ Branch 0 taken 20128 times.
✗ Branch 1 not taken.
|
20128 | if(!p_igetw(&(temp_mapscr->door_combo_set),f)) |
| 16865 | ✗ | return qe_invalid; | |
| 16866 |
2/2✓ Branch 0 taken 80512 times.
✓ Branch 1 taken 20128 times.
|
100640 | for(int32_t k=0; k<4; k++) |
| 16867 | { | ||
| 16868 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 80512 times.
|
80512 | if(!p_getc(&(temp_mapscr->door[k]),f)) |
| 16869 | ✗ | return qe_invalid; | |
| 16870 |
3/4✓ Branch 0 taken 376 times.
✓ Branch 1 taken 80136 times.
✓ Branch 2 taken 376 times.
✗ Branch 3 not taken.
|
80512 | if(version < 29 && temp_mapscr->door[k] == dNONE) |
| 16871 | ✗ | temp_mapscr->door[k] = dWALL; | |
| 16872 | 80512 | } | |
| 16873 | |||
| 16874 |
1/2✓ Branch 0 taken 20128 times.
✗ Branch 1 not taken.
|
20128 | if(!p_getc(&(temp_mapscr->stairx),f)) |
| 16875 | ✗ | return qe_invalid; | |
| 16876 | |||
| 16877 |
1/2✓ Branch 0 taken 20128 times.
✗ Branch 1 not taken.
|
20128 | if(!p_getc(&(temp_mapscr->stairy),f)) |
| 16878 | ✗ | return qe_invalid; | |
| 16879 |
1/2✓ Branch 0 taken 20128 times.
✗ Branch 1 not taken.
|
20128 | if(!p_igetw(&(temp_mapscr->undercombo),f)) |
| 16880 | ✗ | return qe_invalid; | |
| 16881 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 20128 times.
|
20128 | if(!p_getc(&(temp_mapscr->undercset),f)) |
| 16882 | ✗ | return qe_invalid; | |
| 16883 | 20128 | } | |
| 16884 |
2/2✓ Branch 0 taken 14110 times.
✓ Branch 1 taken 10496 times.
|
24606 | else if(version < 29) |
| 16885 | { | ||
| 16886 |
2/2✓ Branch 0 taken 41984 times.
✓ Branch 1 taken 10496 times.
|
52480 | for(int k = 0; k < 4; ++k) |
| 16887 | 41984 | temp_mapscr->door[k] = dWALL; | |
| 16888 | 10496 | } | |
| 16889 |
2/2✓ Branch 0 taken 39001 times.
✓ Branch 1 taken 5733 times.
|
44734 | if(scr_has_flags & SCRHAS_FLAGS) |
| 16890 | { | ||
| 16891 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 5733 times.
|
5733 | if(!p_getc(&(temp_mapscr->flags),f)) |
| 16892 | ✗ | return qe_invalid; | |
| 16893 |
1/2✓ Branch 0 taken 5733 times.
✗ Branch 1 not taken.
|
5733 | if(!p_getc(&(temp_mapscr->flags2),f)) |
| 16894 | ✗ | return qe_invalid; | |
| 16895 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 5733 times.
|
5733 | if(!p_getc(&(temp_mapscr->flags3),f)) |
| 16896 | ✗ | return qe_invalid; | |
| 16897 |
1/2✓ Branch 0 taken 5733 times.
✗ Branch 1 not taken.
|
5733 | if(!p_getc(&(temp_mapscr->flags4),f)) |
| 16898 | ✗ | return qe_invalid; | |
| 16899 |
1/2✓ Branch 0 taken 5733 times.
✗ Branch 1 not taken.
|
5733 | if(!p_getc(&(temp_mapscr->flags5),f)) |
| 16900 | ✗ | return qe_invalid; | |
| 16901 |
1/2✓ Branch 0 taken 5733 times.
✗ Branch 1 not taken.
|
5733 | if(!p_getc(&(temp_mapscr->flags6),f)) |
| 16902 | ✗ | return qe_invalid; | |
| 16903 |
1/2✓ Branch 0 taken 5733 times.
✗ Branch 1 not taken.
|
5733 | if(!p_getc(&(temp_mapscr->flags7),f)) |
| 16904 | ✗ | return qe_invalid; | |
| 16905 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 5733 times.
|
5733 | if(!p_getc(&(temp_mapscr->flags8),f)) |
| 16906 | ✗ | return qe_invalid; | |
| 16907 |
1/2✓ Branch 0 taken 5733 times.
✗ Branch 1 not taken.
|
5733 | if(!p_getc(&(temp_mapscr->flags9),f)) |
| 16908 | ✗ | return qe_invalid; | |
| 16909 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 5733 times.
|
5733 | if(!p_getc(&(temp_mapscr->flags10),f)) |
| 16910 | ✗ | return qe_invalid; | |
| 16911 |
1/2✓ Branch 0 taken 5733 times.
✗ Branch 1 not taken.
|
5733 | if(!p_getc(&(temp_mapscr->enemyflags),f)) |
| 16912 | ✗ | return qe_invalid; | |
| 16913 | 5733 | } | |
| 16914 |
2/2✓ Branch 0 taken 40218 times.
✓ Branch 1 taken 4516 times.
|
44734 | if(scr_has_flags & SCRHAS_ENEMY) |
| 16915 | { | ||
| 16916 |
2/2✓ Branch 0 taken 45160 times.
✓ Branch 1 taken 4516 times.
|
49676 | for(int32_t k=0; k<10; k++) |
| 16917 | { | ||
| 16918 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 45160 times.
|
45160 | if(!p_igetw(&(temp_mapscr->enemy[k]),f)) |
| 16919 | ✗ | return qe_invalid; | |
| 16920 |
1/2✓ Branch 0 taken 45160 times.
✗ Branch 1 not taken.
|
45160 | if (unsigned(temp_mapscr->enemy[k]) > MAXGUYS) |
| 16921 | ✗ | temp_mapscr->enemy[k] = 0; | |
| 16922 | 45160 | } | |
| 16923 |
1/2✓ Branch 0 taken 4516 times.
✗ Branch 1 not taken.
|
4516 | if(!p_getc(&(temp_mapscr->pattern),f)) |
| 16924 | ✗ | return qe_invalid; | |
| 16925 | 4516 | } | |
| 16926 |
2/2✓ Branch 0 taken 44416 times.
✓ Branch 1 taken 318 times.
|
44734 | if(scr_has_flags & SCRHAS_CARRY) |
| 16927 | { | ||
| 16928 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 318 times.
|
318 | if(!p_igetw(&(temp_mapscr->noreset),f)) |
| 16929 | ✗ | return qe_invalid; | |
| 16930 |
1/2✓ Branch 0 taken 318 times.
✗ Branch 1 not taken.
|
318 | if(!p_igetw(&(temp_mapscr->nocarry),f)) |
| 16931 | ✗ | return qe_invalid; | |
| 16932 |
1/2✓ Branch 0 taken 318 times.
✗ Branch 1 not taken.
|
318 | if(!p_getc(&(temp_mapscr->nextmap),f)) |
| 16933 | ✗ | return qe_invalid; | |
| 16934 |
1/2✓ Branch 0 taken 318 times.
✗ Branch 1 not taken.
|
318 | if(!p_getc(&(temp_mapscr->nextscr),f)) |
| 16935 | ✗ | return qe_invalid; | |
| 16936 | 318 | } | |
| 16937 |
2/2✓ Branch 0 taken 44269 times.
✓ Branch 1 taken 465 times.
|
44734 | if(scr_has_flags & SCRHAS_SCRIPT) |
| 16938 | { | ||
| 16939 |
1/2✓ Branch 0 taken 465 times.
✗ Branch 1 not taken.
|
465 | if(!p_igetw(&(temp_mapscr->script),f)) |
| 16940 | ✗ | return qe_invalid; | |
| 16941 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 465 times.
|
465 | if(!p_getc(&(temp_mapscr->preloadscript),f)) |
| 16942 | ✗ | return qe_invalid; | |
| 16943 |
2/2✓ Branch 0 taken 3720 times.
✓ Branch 1 taken 465 times.
|
4185 | for ( int32_t q = 0; q < 8; q++ ) |
| 16944 | { | ||
| 16945 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 3720 times.
|
3720 | if(!p_igetl(&(temp_mapscr->screeninitd[q]),f)) |
| 16946 | ✗ | return qe_invalid; | |
| 16947 | 3720 | } | |
| 16948 | 465 | } | |
| 16949 |
1/2✓ Branch 0 taken 44734 times.
✗ Branch 1 not taken.
|
44734 | if(scr_has_flags & SCRHAS_UNUSED) |
| 16950 | { | ||
| 16951 | ✗ | for ( int32_t q = 0; q < 10; q++ ) | |
| 16952 | { | ||
| 16953 | ✗ | if(!p_igetl(&(temp_mapscr->npcstrings[q]),f)) | |
| 16954 | ✗ | return qe_invalid; | |
| 16955 | ✗ | } | |
| 16956 | ✗ | for ( int32_t q = 0; q < 10; q++ ) | |
| 16957 | { | ||
| 16958 | ✗ | if(!p_igetw(&(temp_mapscr->new_items[q]),f)) | |
| 16959 | ✗ | return qe_invalid; | |
| 16960 | ✗ | } | |
| 16961 | ✗ | for ( int32_t q = 0; q < 10; q++ ) | |
| 16962 | { | ||
| 16963 | ✗ | if(!p_igetw(&(temp_mapscr->new_item_x[q]),f)) | |
| 16964 | ✗ | return qe_invalid; | |
| 16965 | ✗ | } | |
| 16966 | ✗ | for ( int32_t q = 0; q < 10; q++ ) | |
| 16967 | { | ||
| 16968 | ✗ | if(!p_igetw(&(temp_mapscr->new_item_y[q]),f)) | |
| 16969 | ✗ | return qe_invalid; | |
| 16970 | ✗ | } | |
| 16971 | ✗ | } | |
| 16972 |
2/2✓ Branch 0 taken 39670 times.
✓ Branch 1 taken 5064 times.
|
44734 | if(scr_has_flags & SCRHAS_SECRETS) |
| 16973 | { | ||
| 16974 |
2/2✓ Branch 0 taken 648192 times.
✓ Branch 1 taken 5064 times.
|
653256 | for(int32_t k=0; k<128; k++) |
| 16975 | { | ||
| 16976 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 648192 times.
|
648192 | if(!p_igetw(&(temp_mapscr->secretcombo[k]),f)) |
| 16977 | ✗ | return qe_invalid; | |
| 16978 | 648192 | } | |
| 16979 |
2/2✓ Branch 0 taken 648192 times.
✓ Branch 1 taken 5064 times.
|
653256 | for(int32_t k=0; k<128; k++) |
| 16980 | { | ||
| 16981 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 648192 times.
|
648192 | if(!p_getc(&(temp_mapscr->secretcset[k]),f)) |
| 16982 | ✗ | return qe_invalid; | |
| 16983 | 648192 | } | |
| 16984 |
2/2✓ Branch 0 taken 648192 times.
✓ Branch 1 taken 5064 times.
|
653256 | for(int32_t k=0; k<128; k++) |
| 16985 | { | ||
| 16986 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 648192 times.
|
648192 | if(!p_getc(&(temp_mapscr->secretflag[k]),f)) |
| 16987 | ✗ | return qe_invalid; | |
| 16988 | 648192 | } | |
| 16989 | 5064 | } | |
| 16990 |
2/2✓ Branch 0 taken 13165 times.
✓ Branch 1 taken 31569 times.
|
44734 | if(scr_has_flags & SCRHAS_COMBOFLAG) |
| 16991 | { | ||
| 16992 |
2/2✓ Branch 0 taken 5556144 times.
✓ Branch 1 taken 31569 times.
|
5587713 | for(int32_t k=0; k<176; ++k) |
| 16993 | { | ||
| 16994 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 5556144 times.
|
5556144 | if(!p_igetw(&(temp_mapscr->data[k]),f)) |
| 16995 | ✗ | return qe_invalid; | |
| 16996 | 5556144 | } | |
| 16997 |
2/2✓ Branch 0 taken 5556144 times.
✓ Branch 1 taken 31569 times.
|
5587713 | for(int32_t k=0; k<176; ++k) |
| 16998 | { | ||
| 16999 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 5556144 times.
|
5556144 | if(!p_getc(&(temp_mapscr->sflag[k]),f)) |
| 17000 | ✗ | return qe_invalid; | |
| 17001 | 5556144 | } | |
| 17002 |
2/2✓ Branch 0 taken 5556144 times.
✓ Branch 1 taken 31569 times.
|
5587713 | for(int32_t k=0; k<176; ++k) |
| 17003 | { | ||
| 17004 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 5556144 times.
|
5556144 | if(!p_getc(&(temp_mapscr->cset[k]),f)) |
| 17005 | ✗ | return qe_invalid; | |
| 17006 | 5556144 | } | |
| 17007 | 31569 | } | |
| 17008 |
1/2✓ Branch 0 taken 44734 times.
✗ Branch 1 not taken.
|
44734 | if(scr_has_flags & SCRHAS_MISC) |
| 17009 | { | ||
| 17010 |
1/2✓ Branch 0 taken 44734 times.
✗ Branch 1 not taken.
|
44734 | if(!p_igetw(&(temp_mapscr->color),f)) |
| 17011 | ✗ | return qe_invalid; | |
| 17012 |
1/2✓ Branch 0 taken 44734 times.
✗ Branch 1 not taken.
|
44734 | if(!p_getc(&(temp_mapscr->csensitive),f)) |
| 17013 | ✗ | return qe_invalid; | |
| 17014 |
1/2✓ Branch 0 taken 44734 times.
✗ Branch 1 not taken.
|
44734 | if(!p_getc(&(temp_mapscr->oceansfx),f)) |
| 17015 | ✗ | return qe_invalid; | |
| 17016 |
1/2✓ Branch 0 taken 44734 times.
✗ Branch 1 not taken.
|
44734 | if(!p_getc(&(temp_mapscr->bosssfx),f)) |
| 17017 | ✗ | return qe_invalid; | |
| 17018 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 44734 times.
|
44734 | if(!p_getc(&(temp_mapscr->secretsfx),f)) |
| 17019 | ✗ | return qe_invalid; | |
| 17020 |
1/2✓ Branch 0 taken 44734 times.
✗ Branch 1 not taken.
|
44734 | if(!p_getc(&(temp_mapscr->holdupsfx),f)) |
| 17021 | ✗ | return qe_invalid; | |
| 17022 |
1/2✓ Branch 0 taken 44734 times.
✗ Branch 1 not taken.
|
44734 | if(!p_igetw(&(temp_mapscr->timedwarptics),f)) |
| 17023 | ✗ | return qe_invalid; | |
| 17024 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 44734 times.
|
44734 | if(!p_igetw(&(temp_mapscr->screen_midi),f)) |
| 17025 | ✗ | return qe_invalid; | |
| 17026 |
1/2✓ Branch 0 taken 44734 times.
✗ Branch 1 not taken.
|
44734 | if(!p_getc(&(temp_mapscr->lens_layer),f)) |
| 17027 | ✗ | return qe_invalid; | |
| 17028 |
2/2✓ Branch 0 taken 10590 times.
✓ Branch 1 taken 34144 times.
|
44734 | if(version > 27) |
| 17029 | { | ||
| 17030 |
1/2✓ Branch 0 taken 34144 times.
✗ Branch 1 not taken.
|
34144 | if(!p_getc(&(temp_mapscr->lens_show),f)) |
| 17031 | ✗ | return qe_invalid; | |
| 17032 |
1/2✓ Branch 0 taken 34144 times.
✗ Branch 1 not taken.
|
34144 | if(!p_getc(&(temp_mapscr->lens_hide),f)) |
| 17033 | ✗ | return qe_invalid; | |
| 17034 | 34144 | } | |
| 17035 | 44734 | } | |
| 17036 | else | ||
| 17037 | { | ||
| 17038 | ✗ | temp_mapscr->screen_midi = -1; | |
| 17039 | ✗ | temp_mapscr->csensitive = 1; | |
| 17040 | } | ||
| 17041 | //FFC | ||
| 17042 | 44734 | bool old_ff = version < 25; | |
| 17043 | 44734 | dword bits = 0; | |
| 17044 | 44734 | word numffc = 32; | |
| 17045 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 44734 times.
|
44734 | if(old_ff) |
| 17046 | { | ||
| 17047 | ✗ | if(!p_igetl(&bits,f)) | |
| 17048 | ✗ | return qe_invalid; | |
| 17049 | ✗ | } | |
| 17050 | else | ||
| 17051 | { | ||
| 17052 |
1/2✓ Branch 0 taken 44734 times.
✗ Branch 1 not taken.
|
44734 | if(!p_igetw(&numffc,f)) |
| 17053 | ✗ | return qe_invalid; | |
| 17054 | } | ||
| 17055 | byte tempbyte; | ||
| 17056 | word tempw; | ||
| 17057 |
4/6✓ Branch 0 taken 276 times.
✓ Branch 1 taken 44458 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 276 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 276 times.
|
44734 | static ffcdata nil_ffc; |
| 17058 | 44734 | temp_mapscr->ffcCountMarkDirty(); | |
| 17059 |
2/2✓ Branch 0 taken 77609 times.
✓ Branch 1 taken 44734 times.
|
122343 | for(word m = 0; m < numffc; ++m) |
| 17060 | { | ||
| 17061 |
1/2✓ Branch 0 taken 77609 times.
✗ Branch 1 not taken.
|
77609 | ffcdata& tempffc = (m < MAXFFCS) |
| 17062 | 77609 | ? temp_mapscr->ffcs[m] | |
| 17063 | : nil_ffc; //sanity | ||
| 17064 | 77609 | tempffc.clear(); | |
| 17065 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 77609 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
77609 | if(old_ff && !(bits & (1<<m))) continue; |
| 17066 | |||
| 17067 |
1/2✓ Branch 0 taken 77609 times.
✗ Branch 1 not taken.
|
77609 | if(!p_igetw(&tempw,f)) |
| 17068 | ✗ | return qe_invalid; | |
| 17069 |
3/4✓ Branch 0 taken 77609 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 12625 times.
✓ Branch 3 taken 64984 times.
|
77609 | if(!old_ff && !tempw) //empty ffc, nothing more to load |
| 17070 | 64984 | continue; | |
| 17071 | 12625 | tempffc.data = tempw; | |
| 17072 | |||
| 17073 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 12625 times.
|
12625 | if(!p_getc(&(tempffc.cset),f)) |
| 17074 | ✗ | return qe_invalid; | |
| 17075 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 12625 times.
|
12625 | if(!p_igetw(&(tempffc.delay),f)) |
| 17076 | ✗ | return qe_invalid; | |
| 17077 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 12625 times.
|
12625 | if(!p_igetzf(&(tempffc.x),f)) |
| 17078 | ✗ | return qe_invalid; | |
| 17079 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 12625 times.
|
12625 | if(!p_igetzf(&(tempffc.y),f)) |
| 17080 | ✗ | return qe_invalid; | |
| 17081 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 12625 times.
|
12625 | if(!p_igetzf(&(tempffc.vx),f)) |
| 17082 | ✗ | return qe_invalid; | |
| 17083 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 12625 times.
|
12625 | if(!p_igetzf(&(tempffc.vy),f)) |
| 17084 | ✗ | return qe_invalid; | |
| 17085 |
1/2✓ Branch 0 taken 12625 times.
✗ Branch 1 not taken.
|
12625 | if(!p_igetzf(&(tempffc.ax),f)) |
| 17086 | ✗ | return qe_invalid; | |
| 17087 |
1/2✓ Branch 0 taken 12625 times.
✗ Branch 1 not taken.
|
12625 | if(!p_igetzf(&(tempffc.ay),f)) |
| 17088 | ✗ | return qe_invalid; | |
| 17089 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 12625 times.
|
12625 | if(!p_getc(&(tempffc.link),f)) |
| 17090 | ✗ | return qe_invalid; | |
| 17091 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 12625 times.
|
12625 | if(version < 24) |
| 17092 | { | ||
| 17093 | ✗ | if(!p_getc(&tempbyte,f)) | |
| 17094 | ✗ | return qe_invalid; | |
| 17095 | ✗ | tempffc.hit_width = (tempbyte&0x3F)+1; | |
| 17096 | ✗ | tempffc.txsz = (tempbyte>>6)+1; | |
| 17097 | ✗ | if(!p_getc(&tempbyte,f)) | |
| 17098 | ✗ | return qe_invalid; | |
| 17099 | ✗ | tempffc.hit_height = (tempbyte&0x3F)+1; | |
| 17100 | ✗ | tempffc.tysz = (tempbyte>>6)+1; | |
| 17101 | ✗ | } | |
| 17102 | else | ||
| 17103 | { | ||
| 17104 |
1/2✓ Branch 0 taken 12625 times.
✗ Branch 1 not taken.
|
12625 | if(!p_igetl(&(tempffc.hit_width),f)) |
| 17105 | ✗ | return qe_invalid; | |
| 17106 |
1/2✓ Branch 0 taken 12625 times.
✗ Branch 1 not taken.
|
12625 | if(!p_igetl(&(tempffc.hit_height),f)) |
| 17107 | ✗ | return qe_invalid; | |
| 17108 |
1/2✓ Branch 0 taken 12625 times.
✗ Branch 1 not taken.
|
12625 | if(!p_getc(&(tempffc.txsz),f)) |
| 17109 | ✗ | return qe_invalid; | |
| 17110 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 12625 times.
|
12625 | if(!p_getc(&(tempffc.tysz),f)) |
| 17111 | ✗ | return qe_invalid; | |
| 17112 | } | ||
| 17113 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 12625 times.
|
12625 | if(!p_igetl(&(tempffc.flags),f)) |
| 17114 | ✗ | return qe_invalid; | |
| 17115 | 12625 | tempffc.updateSolid(); | |
| 17116 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 12625 times.
|
12625 | if(!p_igetw(&(tempffc.script),f)) |
| 17117 | ✗ | return qe_invalid; | |
| 17118 |
2/2✓ Branch 0 taken 101000 times.
✓ Branch 1 taken 12625 times.
|
113625 | for(auto q = 0; q < 8; ++q) |
| 17119 | { | ||
| 17120 |
1/2✓ Branch 0 taken 101000 times.
✗ Branch 1 not taken.
|
101000 | if(!p_igetl(&(tempffc.initd[q]),f)) |
| 17121 | ✗ | return qe_invalid; | |
| 17122 | 101000 | } | |
| 17123 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 12625 times.
|
12625 | if(!p_getc(&(tempbyte),f)) |
| 17124 | ✗ | return qe_invalid; | |
| 17125 | 12625 | tempffc.inita[0]=tempbyte*10000; | |
| 17126 | |||
| 17127 |
1/2✓ Branch 0 taken 12625 times.
✗ Branch 1 not taken.
|
12625 | if(!p_getc(&(tempbyte),f)) |
| 17128 | ✗ | return qe_invalid; | |
| 17129 | 12625 | tempffc.inita[1]=tempbyte*10000; | |
| 17130 | |||
| 17131 |
1/2✓ Branch 0 taken 12625 times.
✗ Branch 1 not taken.
|
12625 | if(loading_tileset_flags & TILESET_CLEARSCRIPTS) |
| 17132 | { | ||
| 17133 | ✗ | tempffc.script = 0; | |
| 17134 | ✗ | for(int q = 0; q < 8; ++q) | |
| 17135 | ✗ | tempffc.initd[q] = 0; | |
| 17136 | ✗ | } | |
| 17137 | 12625 | } | |
| 17138 |
2/2✓ Branch 0 taken 5648343 times.
✓ Branch 1 taken 44734 times.
|
5693077 | for(word m = numffc; m < MAXFFCS; ++m) |
| 17139 | { | ||
| 17140 | 5648343 | temp_mapscr->ffcs[m].clear(); | |
| 17141 | 5648343 | } | |
| 17142 | //END FFC | ||
| 17143 |
2/2✓ Branch 0 taken 35846 times.
✓ Branch 1 taken 8888 times.
|
44734 | if(version > 29) |
| 17144 |
1/2✓ Branch 0 taken 8888 times.
✗ Branch 1 not taken.
|
8888 | if(!p_getlstr(&temp_mapscr->usr_notes, f)) |
| 17145 | ✗ | return qe_invalid; | |
| 17146 | } | ||
| 17147 | 1199654 | return 0; | |
| 17148 | 1331856 | } | |
| 17149 | |||
| 17150 | |||
| 17151 | 695 | int32_t readmaps(PACKFILE *f, zquestheader *Header) | |
| 17152 | { | ||
| 17153 |
2/2✓ Branch 0 taken 671 times.
✓ Branch 1 taken 24 times.
|
695 | bool should_skip = legacy_skip_flags && get_bit(legacy_skip_flags, skip_maps); |
| 17154 | 695 | int32_t scr=0; | |
| 17155 | |||
| 17156 | 695 | word version=0; | |
| 17157 | dword dummy; | ||
| 17158 | int32_t screens_to_read; | ||
| 17159 | |||
| 17160 | 695 | mapscr temp_mapscr; | |
| 17161 | word temp_map_count; | ||
| 17162 | dword section_size; | ||
| 17163 | |||
| 17164 |
5/6✓ Branch 0 taken 677 times.
✓ Branch 1 taken 18 times.
✓ Branch 2 taken 6 times.
✓ Branch 3 taken 671 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 6 times.
|
695 | if((Header->zelda_version < 0x192)||((Header->zelda_version == 0x192)&&(Header->build<137))) |
| 17165 | { | ||
| 17166 | 18 | screens_to_read=MAPSCRS192b136; | |
| 17167 | 18 | } | |
| 17168 | else | ||
| 17169 | { | ||
| 17170 | 677 | screens_to_read=MAPSCRS; | |
| 17171 | } | ||
| 17172 | |||
| 17173 |
2/2✓ Branch 0 taken 671 times.
✓ Branch 1 taken 24 times.
|
695 | if(Header->zelda_version > 0x192) |
| 17174 | { | ||
| 17175 | //section version info | ||
| 17176 |
2/4✓ Branch 0 taken 671 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 671 times.
✗ Branch 3 not taken.
|
671 | if(!p_igetw(&version,f)) |
| 17177 | { | ||
| 17178 | ✗ | return qe_invalid; | |
| 17179 | } | ||
| 17180 | |||
| 17181 | 671 | FFCore.quest_format[vMaps] = version; | |
| 17182 | |||
| 17183 | //al_trace("Maps version %d\n", version); | ||
| 17184 |
2/4✓ Branch 0 taken 671 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 671 times.
✗ Branch 3 not taken.
|
671 | if(!p_igetw(&dummy,f)) |
| 17185 | { | ||
| 17186 | ✗ | return qe_invalid; | |
| 17187 | } | ||
| 17188 | |||
| 17189 | //section size | ||
| 17190 |
2/4✓ Branch 0 taken 671 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 671 times.
✗ Branch 3 not taken.
|
671 | if(!p_igetl(§ion_size,f)) |
| 17191 | { | ||
| 17192 | ✗ | return qe_invalid; | |
| 17193 | } | ||
| 17194 | |||
| 17195 | //finally... section data | ||
| 17196 |
2/4✓ Branch 0 taken 671 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 671 times.
✗ Branch 3 not taken.
|
671 | if(!p_igetw(&temp_map_count,f)) |
| 17197 | { | ||
| 17198 | ✗ | return 5; | |
| 17199 | } | ||
| 17200 | 671 | } | |
| 17201 | else | ||
| 17202 | { | ||
| 17203 | 24 | temp_map_count=map_count; | |
| 17204 | } | ||
| 17205 | |||
| 17206 |
2/4✓ Branch 0 taken 695 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 695 times.
✗ Branch 3 not taken.
|
695 | if (!(temp_map_count >= 0 && temp_map_count <= MAXMAPS)) |
| 17207 | { | ||
| 17208 | ✗ | return qe_invalid; | |
| 17209 | } | ||
| 17210 | |||
| 17211 |
2/2✓ Branch 0 taken 694 times.
✓ Branch 1 taken 1 times.
|
695 | if (!should_skip) |
| 17212 | { | ||
| 17213 | 694 | const int32_t _mapsSize = MAPSCRS*temp_map_count; | |
| 17214 |
1/2✓ Branch 0 taken 694 times.
✗ Branch 1 not taken.
|
694 | TheMaps.resize(_mapsSize); |
| 17215 | 694 | map_autolayers.clear(); | |
| 17216 |
1/2✓ Branch 0 taken 694 times.
✗ Branch 1 not taken.
|
694 | map_autolayers.resize(temp_map_count*6); |
| 17217 |
2/2✓ Branch 0 taken 1336472 times.
✓ Branch 1 taken 694 times.
|
1337166 | for(int32_t i(0); i<_mapsSize; i++) |
| 17218 |
1/2✓ Branch 0 taken 1336472 times.
✗ Branch 1 not taken.
|
1336472 | TheMaps[i].zero_memory(); |
| 17219 | 694 | } | |
| 17220 | |||
| 17221 |
1/2✓ Branch 0 taken 695 times.
✗ Branch 1 not taken.
|
695 | temp_mapscr.zero_memory(); |
| 17222 | |||
| 17223 |
4/4✓ Branch 0 taken 695 times.
✓ Branch 1 taken 9829 times.
✓ Branch 2 taken 695 times.
✓ Branch 3 taken 9829 times.
|
10524 | for(int32_t i=0; i<temp_map_count && i<MAXMAPS; i++) |
| 17224 | { | ||
| 17225 | 9829 | byte valid=1; | |
| 17226 |
2/2✓ Branch 0 taken 1332 times.
✓ Branch 1 taken 8497 times.
|
9829 | if(version > 22) |
| 17227 | { | ||
| 17228 |
2/4✓ Branch 0 taken 1332 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1332 times.
✗ Branch 3 not taken.
|
1332 | if(!p_getc(&valid,f)) |
| 17229 | ✗ | return qe_invalid; | |
| 17230 | 1332 | } | |
| 17231 |
4/4✓ Branch 0 taken 9798 times.
✓ Branch 1 taken 31 times.
✓ Branch 2 taken 8629 times.
✓ Branch 3 taken 1169 times.
|
9829 | if(valid && version > 25) |
| 17232 | { | ||
| 17233 |
2/2✓ Branch 0 taken 7014 times.
✓ Branch 1 taken 1169 times.
|
8183 | for(int q = 0; q < 6; ++q) |
| 17234 | { | ||
| 17235 |
2/4✓ Branch 0 taken 7014 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 7014 times.
✗ Branch 3 not taken.
|
7014 | if(!p_igetw(&map_autolayers[i*6+q],f)) |
| 17236 | ✗ | return qe_invalid; | |
| 17237 | 7014 | } | |
| 17238 | 1169 | } | |
| 17239 |
2/2✓ Branch 0 taken 1336072 times.
✓ Branch 1 taken 9829 times.
|
1345901 | for(int32_t j=0; j<screens_to_read; j++) |
| 17240 | { | ||
| 17241 | 1336072 | scr=i*MAPSCRS+j; | |
| 17242 |
1/2✓ Branch 0 taken 1336072 times.
✗ Branch 1 not taken.
|
1336072 | clear_screen(&temp_mapscr); |
| 17243 |
2/2✓ Branch 0 taken 1331856 times.
✓ Branch 1 taken 4216 times.
|
1336072 | if(valid) |
| 17244 |
1/2✓ Branch 0 taken 1331856 times.
✗ Branch 1 not taken.
|
1331856 | readmapscreen(f, Header, &temp_mapscr, version, scr); |
| 17245 | |||
| 17246 |
2/2✓ Branch 0 taken 1335800 times.
✓ Branch 1 taken 272 times.
|
1336072 | if (!should_skip) |
| 17247 |
1/2✓ Branch 0 taken 1335800 times.
✗ Branch 1 not taken.
|
1335800 | TheMaps[scr] = temp_mapscr; |
| 17248 | 1336072 | } | |
| 17249 | |||
| 17250 |
2/2✓ Branch 0 taken 9827 times.
✓ Branch 1 taken 2 times.
|
9829 | if (should_skip) |
| 17251 | 2 | continue; | |
| 17252 | |||
| 17253 |
5/6✓ Branch 0 taken 9659 times.
✓ Branch 1 taken 168 times.
✓ Branch 2 taken 18 times.
✓ Branch 3 taken 9641 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 18 times.
|
9827 | if((Header->zelda_version < 0x192)||((Header->zelda_version == 0x192)&&(Header->build<137))) |
| 17254 | { | ||
| 17255 | 168 | int32_t index = (i*MAPSCRS+132); | |
| 17256 | |||
| 17257 |
1/2✓ Branch 0 taken 168 times.
✗ Branch 1 not taken.
|
168 | TheMaps[index]=TheMaps[index-1]; |
| 17258 | |||
| 17259 | 168 | MEMCPY_ARR(TheMaps[i*MAPSCRS+132].data, TheMaps[i*MAPSCRS+131].data); | |
| 17260 | 168 | MEMCPY_ARR(TheMaps[i*MAPSCRS+132].sflag, TheMaps[i*MAPSCRS+131].sflag); | |
| 17261 | 168 | MEMCPY_ARR(TheMaps[i*MAPSCRS+132].cset, TheMaps[i*MAPSCRS+131].cset); | |
| 17262 | |||
| 17263 |
2/2✓ Branch 0 taken 504 times.
✓ Branch 1 taken 168 times.
|
672 | for(int32_t j=133; j<MAPSCRS; j++) |
| 17264 | { | ||
| 17265 | 504 | scr=i*MAPSCRS+j; | |
| 17266 | |||
| 17267 |
1/2✓ Branch 0 taken 504 times.
✗ Branch 1 not taken.
|
504 | TheMaps[scr].zero_memory(); |
| 17268 | 504 | TheMaps[scr].valid = mVERSION; | |
| 17269 | 504 | TheMaps[scr].screen_midi = -1; | |
| 17270 | 504 | TheMaps[scr].csensitive = 1; | |
| 17271 | 504 | } | |
| 17272 | 168 | } | |
| 17273 | |||
| 17274 |
5/6✓ Branch 0 taken 9659 times.
✓ Branch 1 taken 168 times.
✓ Branch 2 taken 18 times.
✓ Branch 3 taken 9641 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 18 times.
|
9827 | if((Header->zelda_version < 0x192)||((Header->zelda_version == 0x192)&&(Header->build<154))) |
| 17275 | { | ||
| 17276 |
2/2✓ Branch 0 taken 22848 times.
✓ Branch 1 taken 168 times.
|
23016 | for(int32_t j=0; j<MAPSCRS; j++) |
| 17277 | { | ||
| 17278 | 22848 | scr=i*MAPSCRS+j; | |
| 17279 | 22848 | TheMaps[scr].door_combo_set=MakeDoors(i, j); | |
| 17280 | |||
| 17281 |
2/2✓ Branch 0 taken 2924544 times.
✓ Branch 1 taken 22848 times.
|
2947392 | for(int32_t k=0; k<128; k++) |
| 17282 | { | ||
| 17283 |
1/2✓ Branch 0 taken 2924544 times.
✗ Branch 1 not taken.
|
2924544 | TheMaps[scr].secretcset[k]=tcmbcset2(i, TheMaps[scr].secretcombo[k]); |
| 17284 |
1/2✓ Branch 0 taken 2924544 times.
✗ Branch 1 not taken.
|
2924544 | TheMaps[scr].secretflag[k]=tcmbflag2(i, TheMaps[scr].secretcombo[k]); |
| 17285 |
1/2✓ Branch 0 taken 2924544 times.
✗ Branch 1 not taken.
|
2924544 | TheMaps[scr].secretcombo[k]=tcmbdat2(i, j, TheMaps[scr].secretcombo[k]); |
| 17286 | 2924544 | } | |
| 17287 | 22848 | } | |
| 17288 | 168 | } | |
| 17289 | 9827 | } | |
| 17290 | 695 | map_count = temp_map_count; | |
| 17291 |
1/2✓ Branch 0 taken 695 times.
✗ Branch 1 not taken.
|
695 | clear_screen(&temp_mapscr); |
| 17292 | 695 | return 0; | |
| 17293 | 695 | } | |
| 17294 | |||
| 17295 | |||
| 17296 | 9852016 | void update_combo(newcombo& cmb, word section_version) | |
| 17297 | { | ||
| 17298 |
2/2✓ Branch 0 taken 2277285 times.
✓ Branch 1 taken 7574731 times.
|
9852016 | if(section_version < 40) |
| 17299 | { | ||
| 17300 |
3/3✓ Branch 0 taken 5025 times.
✓ Branch 1 taken 44980 times.
✓ Branch 2 taken 7524726 times.
|
7574731 | switch(cmb.type) |
| 17301 | { | ||
| 17302 | case cWATER: case cSHALLOWWATER: | ||
| 17303 | 44980 | cmb.attribytes[6] = iwRipples; | |
| 17304 | 44980 | break; | |
| 17305 | case cTALLGRASS: case cTALLGRASSNEXT: case cTALLGRASSTOUCHY: | ||
| 17306 | 5025 | cmb.attribytes[6] = iwTallGrass; | |
| 17307 | 5025 | break; | |
| 17308 | } | ||
| 17309 | 7574731 | } | |
| 17310 | 9852016 | } | |
| 17311 | 277 | int32_t readcombos_old(word section_version, PACKFILE *f, zquestheader *, word version, word build, word start_combo, word max_combos) | |
| 17312 | { | ||
| 17313 |
2/2✓ Branch 0 taken 253 times.
✓ Branch 1 taken 24 times.
|
277 | bool should_skip = legacy_skip_flags && get_bit(legacy_skip_flags, skip_combos); |
| 17314 | |||
| 17315 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 276 times.
|
277 | if (!should_skip) |
| 17316 | { | ||
| 17317 | 276 | reset_combo_animations(); | |
| 17318 | 276 | reset_combo_animations2(); | |
| 17319 | 276 | init_combo_classes(); | |
| 17320 | 276 | } | |
| 17321 | |||
| 17322 | // combos | ||
| 17323 | 277 | word combos_used=0; | |
| 17324 | int32_t dummy; | ||
| 17325 | byte padding; | ||
| 17326 | 277 | newcombo temp_combo; | |
| 17327 | //word section_cversion=0; | ||
| 17328 | |||
| 17329 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 276 times.
|
277 | if (!should_skip) |
| 17330 |
2/2✓ Branch 0 taken 18017280 times.
✓ Branch 1 taken 276 times.
|
18017556 | for(int32_t q = start_combo; q < start_combo+max_combos; ++q) |
| 17331 |
1/2✓ Branch 0 taken 18017280 times.
✗ Branch 1 not taken.
|
18017556 | combobuf[q].clear(); |
| 17332 | |||
| 17333 | // if(version > 0x192) | ||
| 17334 | // { | ||
| 17335 | // //section version info | ||
| 17336 | // if(!p_igetw(§ion_version,f)) | ||
| 17337 | // { | ||
| 17338 | // return qe_invalid; | ||
| 17339 | // } | ||
| 17340 | |||
| 17341 | // FFCore.quest_format[vCombos] = section_version; | ||
| 17342 | |||
| 17343 | // //al_trace("Combos version %d\n", section_version); | ||
| 17344 | // if(!p_igetw(§ion_cversion,f)) | ||
| 17345 | // { | ||
| 17346 | // return qe_invalid; | ||
| 17347 | // } | ||
| 17348 | |||
| 17349 | // //section size | ||
| 17350 | // if(!p_igetl(&dummy,f)) | ||
| 17351 | // { | ||
| 17352 | // return qe_invalid; | ||
| 17353 | // } | ||
| 17354 | // } | ||
| 17355 | |||
| 17356 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 277 times.
|
277 | if(version < 0x174) |
| 17357 | { | ||
| 17358 | ✗ | combos_used=1024; | |
| 17359 | ✗ | } | |
| 17360 |
2/2✓ Branch 0 taken 259 times.
✓ Branch 1 taken 18 times.
|
277 | else if(version < 0x191) |
| 17361 | { | ||
| 17362 | 18 | combos_used=2048; | |
| 17363 | 18 | } | |
| 17364 | else | ||
| 17365 | { | ||
| 17366 |
2/4✓ Branch 0 taken 259 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 259 times.
✗ Branch 3 not taken.
|
259 | if(!p_igetw(&combos_used,f)) |
| 17367 | { | ||
| 17368 | ✗ | return qe_invalid; | |
| 17369 | } | ||
| 17370 | } | ||
| 17371 | |||
| 17372 | //finally... section data | ||
| 17373 |
2/2✓ Branch 0 taken 7439715 times.
✓ Branch 1 taken 277 times.
|
7439992 | for(int32_t i=0; i<combos_used; i++) |
| 17374 | { | ||
| 17375 |
1/2✓ Branch 0 taken 7439715 times.
✗ Branch 1 not taken.
|
7439715 | temp_combo.clear(); |
| 17376 | |||
| 17377 |
2/2✓ Branch 0 taken 202968 times.
✓ Branch 1 taken 7236747 times.
|
7439715 | if ( section_version >= 11 ) |
| 17378 | { | ||
| 17379 |
2/4✓ Branch 0 taken 202968 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 202968 times.
✗ Branch 3 not taken.
|
202968 | if(!p_igetl(&temp_combo.tile,f)) |
| 17380 | { | ||
| 17381 | ✗ | return qe_invalid; | |
| 17382 | } | ||
| 17383 | 202968 | } | |
| 17384 | else | ||
| 17385 | { | ||
| 17386 |
2/4✓ Branch 0 taken 7236747 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 7236747 times.
✗ Branch 3 not taken.
|
7236747 | if(!p_igetw(&temp_combo.tile,f)) |
| 17387 | { | ||
| 17388 | ✗ | return qe_invalid; | |
| 17389 | } | ||
| 17390 | } | ||
| 17391 | 7439715 | temp_combo.o_tile = temp_combo.tile; | |
| 17392 |
2/4✓ Branch 0 taken 7439715 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 7439715 times.
✗ Branch 3 not taken.
|
7439715 | if(!p_getc(&temp_combo.flip,f)) |
| 17393 | { | ||
| 17394 | ✗ | return qe_invalid; | |
| 17395 | } | ||
| 17396 | |||
| 17397 |
2/4✓ Branch 0 taken 7439715 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 7439715 times.
✗ Branch 3 not taken.
|
7439715 | if(!p_getc(&temp_combo.walk,f)) |
| 17398 | { | ||
| 17399 | ✗ | return qe_invalid; | |
| 17400 | } | ||
| 17401 | |||
| 17402 |
2/4✓ Branch 0 taken 7439715 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 7439715 times.
✗ Branch 3 not taken.
|
7439715 | if(!p_getc(&temp_combo.type,f)) |
| 17403 | { | ||
| 17404 | ✗ | return qe_invalid; | |
| 17405 | } | ||
| 17406 | |||
| 17407 |
2/4✓ Branch 0 taken 7439715 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 7439715 times.
✗ Branch 3 not taken.
|
7439715 | if(!p_getc(&temp_combo.csets,f)) |
| 17408 | { | ||
| 17409 | ✗ | return qe_invalid; | |
| 17410 | } | ||
| 17411 | |||
| 17412 |
2/2✓ Branch 0 taken 69774 times.
✓ Branch 1 taken 7369941 times.
|
7439715 | if(version < 0x193) |
| 17413 | { | ||
| 17414 |
2/4✓ Branch 0 taken 69774 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 69774 times.
✗ Branch 3 not taken.
|
69774 | if(!p_getc(&padding,f)) |
| 17415 | ✗ | return qe_invalid; | |
| 17416 | |||
| 17417 |
2/4✓ Branch 0 taken 69774 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 69774 times.
✗ Branch 3 not taken.
|
69774 | if(!p_getc(&padding,f)) |
| 17418 | ✗ | return qe_invalid; | |
| 17419 | |||
| 17420 |
2/2✓ Branch 0 taken 32910 times.
✓ Branch 1 taken 36864 times.
|
69774 | if(version < 0x192) |
| 17421 | { | ||
| 17422 |
1/2✓ Branch 0 taken 36864 times.
✗ Branch 1 not taken.
|
36864 | if(version == 0x191) |
| 17423 | { | ||
| 17424 | ✗ | for(int32_t tmpcounter=0; tmpcounter<16; tmpcounter++) | |
| 17425 | { | ||
| 17426 | ✗ | if(!p_getc(&padding,f)) | |
| 17427 | ✗ | return qe_invalid; | |
| 17428 | ✗ | } | |
| 17429 | ✗ | } | |
| 17430 | 36864 | } | |
| 17431 | 69774 | } | |
| 17432 |
2/2✓ Branch 0 taken 7402851 times.
✓ Branch 1 taken 36864 times.
|
7439715 | if(version >= 0x192) |
| 17433 | { | ||
| 17434 |
2/4✓ Branch 0 taken 7402851 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 7402851 times.
✗ Branch 3 not taken.
|
7402851 | if(!p_getc(&temp_combo.frames,f)) |
| 17435 | ✗ | return qe_invalid; | |
| 17436 | |||
| 17437 |
2/4✓ Branch 0 taken 7402851 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 7402851 times.
✗ Branch 3 not taken.
|
7402851 | if(!p_getc(&temp_combo.speed,f)) |
| 17438 | ✗ | return qe_invalid; | |
| 17439 | |||
| 17440 |
2/4✓ Branch 0 taken 7402851 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 7402851 times.
✗ Branch 3 not taken.
|
7402851 | if(!p_igetw(&temp_combo.nextcombo,f)) |
| 17441 | ✗ | return qe_invalid; | |
| 17442 | |||
| 17443 |
2/4✓ Branch 0 taken 7402851 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 7402851 times.
✗ Branch 3 not taken.
|
7402851 | if(!p_getc(&temp_combo.nextcset,f)) |
| 17444 | ✗ | return qe_invalid; | |
| 17445 | |||
| 17446 | //Base flag | ||
| 17447 |
2/2✓ Branch 0 taken 4514443 times.
✓ Branch 1 taken 2888408 times.
|
7402851 | if(section_version>=3) |
| 17448 |
2/4✓ Branch 0 taken 4514443 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4514443 times.
✗ Branch 3 not taken.
|
4514443 | if(!p_getc(&temp_combo.flag,f)) |
| 17449 | ✗ | return qe_invalid; | |
| 17450 | |||
| 17451 |
2/2✓ Branch 0 taken 4514443 times.
✓ Branch 1 taken 2888408 times.
|
7402851 | if(section_version>=4) |
| 17452 | { | ||
| 17453 |
2/4✓ Branch 0 taken 4514443 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4514443 times.
✗ Branch 3 not taken.
|
4514443 | if(!p_getc(&temp_combo.skipanim,f)) |
| 17454 | ✗ | return qe_invalid; | |
| 17455 | |||
| 17456 |
2/4✓ Branch 0 taken 4514443 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4514443 times.
✗ Branch 3 not taken.
|
4514443 | if(!p_igetw(&temp_combo.nexttimer,f)) |
| 17457 | ✗ | return qe_invalid; | |
| 17458 | 4514443 | } | |
| 17459 | |||
| 17460 |
2/2✓ Branch 0 taken 4514443 times.
✓ Branch 1 taken 2888408 times.
|
7402851 | if(section_version>=5) |
| 17461 |
2/4✓ Branch 0 taken 4514443 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4514443 times.
✗ Branch 3 not taken.
|
4514443 | if(!p_getc(&temp_combo.skipanimy,f)) |
| 17462 | ✗ | return qe_invalid; | |
| 17463 | |||
| 17464 |
2/2✓ Branch 0 taken 4514443 times.
✓ Branch 1 taken 2888408 times.
|
7402851 | if(section_version>=6) |
| 17465 | { | ||
| 17466 |
2/4✓ Branch 0 taken 4514443 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4514443 times.
✗ Branch 3 not taken.
|
4514443 | if(!p_getc(&temp_combo.animflags,f)) |
| 17467 | ✗ | return qe_invalid; | |
| 17468 | |||
| 17469 |
1/2✓ Branch 0 taken 4514443 times.
✗ Branch 1 not taken.
|
4514443 | if(section_version == 6) |
| 17470 | ✗ | temp_combo.animflags = temp_combo.animflags ? AF_FRESH : 0; | |
| 17471 | 4514443 | } | |
| 17472 | |||
| 17473 |
2/2✓ Branch 0 taken 7199883 times.
✓ Branch 1 taken 202968 times.
|
7402851 | if(section_version>=8) //combo Attributes[4] and userflags. |
| 17474 | { | ||
| 17475 |
2/2✓ Branch 0 taken 202968 times.
✓ Branch 1 taken 811872 times.
|
1014840 | for ( int32_t q = 0; q < NUM_COMBO_ATTRIBUTES; q++ ) |
| 17476 |
2/4✓ Branch 0 taken 811872 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 811872 times.
✗ Branch 3 not taken.
|
811872 | if(!p_igetl(&temp_combo.attributes[q],f)) |
| 17477 | ✗ | return qe_invalid; | |
| 17478 |
2/4✓ Branch 0 taken 202968 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 202968 times.
✗ Branch 3 not taken.
|
202968 | if(!p_igetl(&temp_combo.usrflags,f)) |
| 17479 | ✗ | return qe_invalid; | |
| 17480 |
1/2✓ Branch 0 taken 202968 times.
✗ Branch 1 not taken.
|
202968 | if(section_version >= 20) |
| 17481 |
2/4✓ Branch 0 taken 202968 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 202968 times.
✗ Branch 3 not taken.
|
202968 | if(!p_igetw(&temp_combo.genflags,f)) |
| 17482 | ✗ | return qe_invalid; | |
| 17483 | 202968 | } | |
| 17484 |
2/2✓ Branch 0 taken 202968 times.
✓ Branch 1 taken 7199883 times.
|
7402851 | if(section_version>=10) //combo trigger flags |
| 17485 | { | ||
| 17486 |
2/2✓ Branch 0 taken 608904 times.
✓ Branch 1 taken 202968 times.
|
811872 | for ( int32_t q = 0; q < 3; q++ ) |
| 17487 |
2/4✓ Branch 0 taken 608904 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 608904 times.
✗ Branch 3 not taken.
|
608904 | if(!p_igetl(&temp_combo.triggerflags[q],f)) |
| 17488 | ✗ | return qe_invalid; | |
| 17489 | 202968 | } | |
| 17490 |
1/2✓ Branch 0 taken 7199883 times.
✗ Branch 1 not taken.
|
7199883 | else if(section_version==9) //combo trigger flags, V9 only had two indices of triggerflags[] |
| 17491 | { | ||
| 17492 | ✗ | for ( int32_t q = 0; q < 2; q++ ) | |
| 17493 | ✗ | if(!p_igetl(&temp_combo.triggerflags[q],f)) | |
| 17494 | ✗ | return qe_invalid; | |
| 17495 | ✗ | } | |
| 17496 |
2/2✓ Branch 0 taken 202968 times.
✓ Branch 1 taken 7199883 times.
|
7402851 | if(section_version >= 9) |
| 17497 |
2/4✓ Branch 0 taken 202968 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 202968 times.
✗ Branch 3 not taken.
|
202968 | if(!p_igetl(&temp_combo.triggerlevel,f)) |
| 17498 | ✗ | return qe_invalid; | |
| 17499 |
2/2✓ Branch 0 taken 202968 times.
✓ Branch 1 taken 7199883 times.
|
7402851 | if(section_version >= 22) |
| 17500 |
2/4✓ Branch 0 taken 202968 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 202968 times.
✗ Branch 3 not taken.
|
202968 | if(!p_getc(&temp_combo.triggerbtn,f)) |
| 17501 | ✗ | return qe_invalid; | |
| 17502 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 7402851 times.
|
7402851 | if(section_version >= 24) |
| 17503 | { | ||
| 17504 | ✗ | if(!p_getc(&temp_combo.triggeritem,f)) | |
| 17505 | ✗ | return qe_invalid; | |
| 17506 | ✗ | if(!p_getc(&temp_combo.trigtimer,f)) | |
| 17507 | ✗ | return qe_invalid; | |
| 17508 | ✗ | } | |
| 17509 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 7402851 times.
|
7402851 | if(section_version >= 25) |
| 17510 | ✗ | if(!p_getc(&temp_combo.trigsfx,f)) | |
| 17511 | ✗ | return qe_invalid; | |
| 17512 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 7402851 times.
|
7402851 | if(section_version >= 27) |
| 17513 | ✗ | if(!p_igetl(&temp_combo.trigchange,f)) | |
| 17514 | ✗ | return qe_invalid; | |
| 17515 | |||
| 17516 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 7402851 times.
|
7402851 | if(section_version >= 29) |
| 17517 | { | ||
| 17518 | ✗ | if(!p_igetw(&temp_combo.trigprox,f)) | |
| 17519 | ✗ | return qe_invalid; | |
| 17520 | ✗ | if(!p_getc(&temp_combo.trigctr,f)) | |
| 17521 | ✗ | return qe_invalid; | |
| 17522 | ✗ | if(!p_igetl(&temp_combo.trigctramnt,f)) | |
| 17523 | ✗ | return qe_invalid; | |
| 17524 | ✗ | } | |
| 17525 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 7402851 times.
|
7402851 | if(section_version >= 30) |
| 17526 | ✗ | if(!p_getc(&temp_combo.triglbeam,f)) | |
| 17527 | ✗ | return qe_invalid; | |
| 17528 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 7402851 times.
|
7402851 | if(section_version >= 31) |
| 17529 | { | ||
| 17530 | ✗ | if(!p_getc(&temp_combo.trigcschange,f)) | |
| 17531 | ✗ | return qe_invalid; | |
| 17532 | ✗ | if(!p_igetw(&temp_combo.spawnitem,f)) | |
| 17533 | ✗ | return qe_invalid; | |
| 17534 | ✗ | if(!p_igetw(&temp_combo.spawnenemy,f)) | |
| 17535 | ✗ | return qe_invalid; | |
| 17536 | ✗ | if(!p_getc(&temp_combo.exstate,f)) | |
| 17537 | ✗ | return qe_invalid; | |
| 17538 | ✗ | if(!p_igetl(&temp_combo.spawnip,f)) | |
| 17539 | ✗ | return qe_invalid; | |
| 17540 | ✗ | if(!p_getc(&temp_combo.trigcopycat,f)) | |
| 17541 | ✗ | return qe_invalid; | |
| 17542 | ✗ | } | |
| 17543 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 7402851 times.
|
7402851 | if(section_version >= 32) |
| 17544 | ✗ | if(!p_getc(&temp_combo.trigcooldown,f)) | |
| 17545 | ✗ | return qe_invalid; | |
| 17546 | |||
| 17547 |
2/2✓ Branch 0 taken 7199883 times.
✓ Branch 1 taken 202968 times.
|
7402851 | if(section_version>=12) //combo label |
| 17548 | { | ||
| 17549 | char label[12]; | ||
| 17550 | 202968 | label[11] = '\0'; | |
| 17551 |
2/2✓ Branch 0 taken 202968 times.
✓ Branch 1 taken 2232648 times.
|
2435616 | for ( int32_t q = 0; q < 11; q++ ) |
| 17552 |
2/4✓ Branch 0 taken 2232648 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2232648 times.
✗ Branch 3 not taken.
|
2232648 | if(!p_getc(&label[q],f)) |
| 17553 | ✗ | return qe_invalid; | |
| 17554 |
1/2✓ Branch 0 taken 202968 times.
✗ Branch 1 not taken.
|
202968 | temp_combo.label = label; |
| 17555 | 202968 | } | |
| 17556 |
2/2✓ Branch 0 taken 7199883 times.
✓ Branch 1 taken 202968 times.
|
7402851 | if(section_version>=13) //attribytes[4] |
| 17557 |
2/2✓ Branch 0 taken 811872 times.
✓ Branch 1 taken 202968 times.
|
1014840 | for ( int32_t q = 0; q < 4; q++ ) |
| 17558 |
2/4✓ Branch 0 taken 811872 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 811872 times.
✗ Branch 3 not taken.
|
811872 | if(!p_getc(&temp_combo.attribytes[q],f)) |
| 17559 | 202968 | return qe_invalid; | |
| 17560 | /* HIGHLY UNORTHODOX UPDATING THING, by Deedee | ||
| 17561 | * This fixes a poor implementation of a ->next flag bug thing. | ||
| 17562 | * Zoria didn't bump up the versions as liberally as he should have, but thankfully | ||
| 17563 | * there was a version bump a few weeks before a change that broke stuff. | ||
| 17564 | */ | ||
| 17565 |
3/4✓ Branch 0 taken 202968 times.
✓ Branch 1 taken 7199883 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 202968 times.
|
7402851 | if (section_version >= 13 && section_version < 21) |
| 17566 | { | ||
| 17567 | ✗ | set_qr(qr_BUGGY_BUGGY_SLASH_TRIGGERS,1); | |
| 17568 | ✗ | } | |
| 17569 | //combo scripts | ||
| 17570 |
2/2✓ Branch 0 taken 202968 times.
✓ Branch 1 taken 7199883 times.
|
7402851 | if(section_version>=14) |
| 17571 | { | ||
| 17572 |
2/4✓ Branch 0 taken 202968 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 202968 times.
✗ Branch 3 not taken.
|
202968 | if(!p_igetw(&temp_combo.script,f)) |
| 17573 | ✗ | return qe_invalid; | |
| 17574 |
2/2✓ Branch 0 taken 405936 times.
✓ Branch 1 taken 202968 times.
|
608904 | for ( int32_t q = 0; q < 2; q++ ) |
| 17575 |
2/4✓ Branch 0 taken 405936 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 405936 times.
✗ Branch 3 not taken.
|
405936 | if(!p_igetl(&temp_combo.initd[q],f)) |
| 17576 | ✗ | return qe_invalid; | |
| 17577 | 202968 | } | |
| 17578 | //al_trace("Read combo script data\n"); | ||
| 17579 |
2/2✓ Branch 0 taken 202968 times.
✓ Branch 1 taken 7199883 times.
|
7402851 | if(section_version>=15) |
| 17580 | { | ||
| 17581 |
2/4✓ Branch 0 taken 202968 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 202968 times.
✗ Branch 3 not taken.
|
202968 | if(!p_igetl(&temp_combo.o_tile,f)) return qe_invalid; |
| 17582 |
2/2✓ Branch 0 taken 107633 times.
✓ Branch 1 taken 95335 times.
|
202968 | if(!temp_combo.o_tile) temp_combo.o_tile = temp_combo.tile; |
| 17583 |
2/4✓ Branch 0 taken 202968 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 202968 times.
✗ Branch 3 not taken.
|
202968 | if(!p_getc(&temp_combo.cur_frame,f)) return qe_invalid; |
| 17584 |
2/4✓ Branch 0 taken 202968 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 202968 times.
✗ Branch 3 not taken.
|
202968 | if(!p_getc(&temp_combo.aclk,f)) return qe_invalid; |
| 17585 | 202968 | } | |
| 17586 |
2/2✓ Branch 0 taken 7199883 times.
✓ Branch 1 taken 202968 times.
|
7402851 | if(section_version>=17) //attribytes[4] |
| 17587 | { | ||
| 17588 |
2/2✓ Branch 0 taken 811872 times.
✓ Branch 1 taken 202968 times.
|
1014840 | for ( int32_t q = 4; q < 8; q++ ) //bump up attribytes... |
| 17589 |
2/4✓ Branch 0 taken 811872 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 811872 times.
✗ Branch 3 not taken.
|
811872 | if(!p_getc(&temp_combo.attribytes[q],f)) |
| 17590 | ✗ | return qe_invalid; | |
| 17591 |
2/2✓ Branch 0 taken 1623744 times.
✓ Branch 1 taken 202968 times.
|
1826712 | for ( int32_t q = 0; q < 8; q++ ) //...and add attrishorts |
| 17592 |
2/4✓ Branch 0 taken 1623744 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1623744 times.
✗ Branch 3 not taken.
|
1623744 | if(!p_igetw(&temp_combo.attrishorts[q],f)) |
| 17593 | ✗ | return qe_invalid; | |
| 17594 | 202968 | } | |
| 17595 | |||
| 17596 |
2/2✓ Branch 0 taken 7369941 times.
✓ Branch 1 taken 32910 times.
|
7402851 | if(version < 0x193) |
| 17597 |
2/2✓ Branch 0 taken 362010 times.
✓ Branch 1 taken 32910 times.
|
394920 | for(int32_t q=0; q<11; q++) |
| 17598 |
2/4✓ Branch 0 taken 362010 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 362010 times.
✗ Branch 3 not taken.
|
362010 | if(!p_getc(&dummy,f)) |
| 17599 | 32910 | return qe_invalid; | |
| 17600 | 7402851 | } | |
| 17601 | |||
| 17602 | //Goriya tiles were flipped around in 2.11 build 7. Compensate for the flip here. -DD | ||
| 17603 |
3/6✓ Branch 0 taken 4514443 times.
✓ Branch 1 taken 2925272 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 4514443 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
7439715 | if((version < 0x211)||((version == 0x211)&&(build<7))) |
| 17604 | { | ||
| 17605 |
2/2✓ Branch 0 taken 2885336 times.
✓ Branch 1 taken 39936 times.
|
2925272 | if(!get_qr(qr_NEWENEMYTILES)) |
| 17606 | { | ||
| 17607 |
1/5✓ Branch 0 taken 39936 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
|
39936 | switch(temp_combo.tile) |
| 17608 | { | ||
| 17609 | case 130: | ||
| 17610 | ✗ | temp_combo.tile = 132; | |
| 17611 | ✗ | break; | |
| 17612 | |||
| 17613 | case 131: | ||
| 17614 | ✗ | temp_combo.tile = 133; | |
| 17615 | ✗ | break; | |
| 17616 | |||
| 17617 | case 132: | ||
| 17618 | ✗ | temp_combo.tile = 130; | |
| 17619 | ✗ | break; | |
| 17620 | |||
| 17621 | case 133: | ||
| 17622 | ✗ | temp_combo.tile = 131; | |
| 17623 | ✗ | break; | |
| 17624 | } | ||
| 17625 | 39936 | } | |
| 17626 | 2925272 | } | |
| 17627 | |||
| 17628 |
2/2✓ Branch 0 taken 202968 times.
✓ Branch 1 taken 7236747 times.
|
7439715 | if(section_version < 15) |
| 17629 | 7236747 | temp_combo.o_tile = temp_combo.tile; | |
| 17630 | |||
| 17631 |
2/2✓ Branch 0 taken 202968 times.
✓ Branch 1 taken 7236747 times.
|
7439715 | if(section_version<18) //upper bits for .walk |
| 17632 | 7236747 | temp_combo.walk |= 0xF0; | |
| 17633 | |||
| 17634 |
2/2✓ Branch 0 taken 202968 times.
✓ Branch 1 taken 7236747 times.
|
7439715 | if(section_version < 19) |
| 17635 |
2/2✓ Branch 0 taken 28946988 times.
✓ Branch 1 taken 7236747 times.
|
36183735 | for(int32_t q = 0; q < 4; ++q) |
| 17636 | 36183735 | temp_combo.attributes[q] *= 10000L; | |
| 17637 | |||
| 17638 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 7439715 times.
|
7439715 | if(section_version < 23) |
| 17639 | { | ||
| 17640 |
2/2✓ Branch 0 taken 14731 times.
✓ Branch 1 taken 7424984 times.
|
7439715 | switch(temp_combo.type) //combotriggerCMBTYPEFX now required for combotype-specific effects |
| 17641 | { | ||
| 17642 | case cSCRIPT1: case cSCRIPT2: case cSCRIPT3: case cSCRIPT4: case cSCRIPT5: | ||
| 17643 | case cSCRIPT6: case cSCRIPT7: case cSCRIPT8: case cSCRIPT9: case cSCRIPT10: | ||
| 17644 | case cTRIGGERGENERIC: case cCSWITCH: | ||
| 17645 | 14731 | temp_combo.triggerflags[0] |= combotriggerCMBTYPEFX; | |
| 17646 | 14731 | } | |
| 17647 | 7439715 | } | |
| 17648 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 7439715 times.
|
7439715 | if(section_version < 25) |
| 17649 | { | ||
| 17650 |
2/2✓ Branch 0 taken 26963 times.
✓ Branch 1 taken 7412752 times.
|
7439715 | switch(temp_combo.type) |
| 17651 | { | ||
| 17652 | case cLOCKBLOCK: case cBOSSLOCKBLOCK: | ||
| 17653 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 26963 times.
|
26963 | if(!(temp_combo.usrflags & cflag3)) |
| 17654 | 26963 | temp_combo.attribytes[3] = WAV_DOOR; | |
| 17655 | 26963 | temp_combo.usrflags &= ~cflag3; | |
| 17656 | 26963 | break; | |
| 17657 | } | ||
| 17658 | 7439715 | } | |
| 17659 | |||
| 17660 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 7439715 times.
|
7439715 | if(section_version < 26) |
| 17661 |
2/2✓ Branch 0 taken 7438615 times.
✓ Branch 1 taken 1100 times.
|
7440815 | if(temp_combo.type == cARMOS) |
| 17662 |
1/2✓ Branch 0 taken 1100 times.
✗ Branch 1 not taken.
|
1100 | if(temp_combo.usrflags & cflag1) |
| 17663 | ✗ | temp_combo.usrflags |= cflag3; | |
| 17664 | |||
| 17665 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 7439715 times.
|
7439715 | if(section_version < 27) |
| 17666 | { | ||
| 17667 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 7439715 times.
|
7439715 | if(temp_combo.triggerflags[0] & 0x00040000) //'next' |
| 17668 | ✗ | temp_combo.trigchange = 1; | |
| 17669 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 7439715 times.
|
7439715 | else if(temp_combo.triggerflags[0] & 0x00080000) //'prev' |
| 17670 | ✗ | temp_combo.trigchange = -1; | |
| 17671 | 7439715 | else temp_combo.trigchange = 0; | |
| 17672 | 7439715 | temp_combo.triggerflags[0] &= ~(0x00040000|0x00080000); | |
| 17673 | 7439715 | } | |
| 17674 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 7439715 times.
|
7439715 | if(section_version < 28) |
| 17675 | { | ||
| 17676 |
2/2✓ Branch 0 taken 15216 times.
✓ Branch 1 taken 7424499 times.
|
7439715 | switch(temp_combo.type) |
| 17677 | { | ||
| 17678 | case cLOCKBLOCK: case cLOCKEDCHEST: | ||
| 17679 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 15216 times.
|
15216 | if(temp_combo.usrflags & cflag7) |
| 17680 | ✗ | temp_combo.usrflags |= cflag8; | |
| 17681 | 15216 | else temp_combo.usrflags &= ~cflag8; | |
| 17682 | 15216 | temp_combo.usrflags &= ~cflag7; | |
| 17683 | 15216 | break; | |
| 17684 | } | ||
| 17685 |
2/2✓ Branch 0 taken 751 times.
✓ Branch 1 taken 7438964 times.
|
7439715 | switch(temp_combo.type) |
| 17686 | { | ||
| 17687 | case cCHEST: case cLOCKEDCHEST: case cBOSSCHEST: | ||
| 17688 | 751 | temp_combo.attrishorts[2] = -1; | |
| 17689 | 751 | temp_combo.usrflags |= cflag7; | |
| 17690 | 751 | break; | |
| 17691 | } | ||
| 17692 | 7439715 | } | |
| 17693 |
2/2✓ Branch 0 taken 202968 times.
✓ Branch 1 taken 7236747 times.
|
7439715 | if(section_version < 20) |
| 17694 | { | ||
| 17695 | 7236747 | temp_combo.genflags = 0; | |
| 17696 |
2/2✓ Branch 0 taken 141882 times.
✓ Branch 1 taken 7094865 times.
|
7236747 | switch(temp_combo.type) |
| 17697 | { | ||
| 17698 | case cPUSH_WAIT: case cPUSH_HEAVY: | ||
| 17699 | case cPUSH_HW: case cL_STATUE: | ||
| 17700 | case cR_STATUE: case cPUSH_HEAVY2: | ||
| 17701 | case cPUSH_HW2: case cPOUND: | ||
| 17702 | case cC_STATUE: case cMIRROR: | ||
| 17703 | case cMIRRORSLASH: case cMIRRORBACKSLASH: | ||
| 17704 | case cMAGICPRISM: case cMAGICPRISM4: | ||
| 17705 | case cMAGICSPONGE: case cEYEBALL_A: | ||
| 17706 | case cEYEBALL_B: case cEYEBALL_4: | ||
| 17707 | case cBUSH: case cFLOWERS: | ||
| 17708 | case cLOCKBLOCK: case cLOCKBLOCK2: | ||
| 17709 | case cBOSSLOCKBLOCK: case cBOSSLOCKBLOCK2: | ||
| 17710 | case cCHEST: case cCHEST2: | ||
| 17711 | case cLOCKEDCHEST: case cLOCKEDCHEST2: | ||
| 17712 | case cBOSSCHEST: case cBOSSCHEST2: | ||
| 17713 | case cBUSHNEXT: case cBUSHTOUCHY: | ||
| 17714 | case cFLOWERSTOUCHY: case cBUSHNEXTTOUCHY: | ||
| 17715 | case cSIGNPOST: case cCSWITCHBLOCK: | ||
| 17716 | case cTORCH: case cTRIGGERGENERIC: | ||
| 17717 |
1/2✓ Branch 0 taken 141882 times.
✗ Branch 1 not taken.
|
141882 | if(temp_combo.usrflags & cflag16) |
| 17718 | { | ||
| 17719 | ✗ | temp_combo.genflags |= cflag1; | |
| 17720 | ✗ | temp_combo.usrflags &= ~cflag16; | |
| 17721 | ✗ | } | |
| 17722 | 141882 | break; | |
| 17723 | } | ||
| 17724 | 7236747 | } | |
| 17725 | |||
| 17726 | 7439715 | update_combo(temp_combo, section_version); | |
| 17727 | |||
| 17728 |
3/4✓ Branch 0 taken 7439715 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 7424796 times.
✓ Branch 3 taken 14919 times.
|
7439715 | if(i>=start_combo && !should_skip) |
| 17729 | { | ||
| 17730 |
1/2✓ Branch 0 taken 7424796 times.
✗ Branch 1 not taken.
|
7424796 | if(loading_tileset_flags & TILESET_CLEARSCRIPTS) |
| 17731 | { | ||
| 17732 | ✗ | temp_combo.script = 0; | |
| 17733 | ✗ | for(int q = 0; q < 8; ++q) | |
| 17734 | ✗ | temp_combo.initd[q] = 0; | |
| 17735 | ✗ | } | |
| 17736 |
1/2✓ Branch 0 taken 7424796 times.
✗ Branch 1 not taken.
|
7424796 | combobuf[i] = temp_combo; |
| 17737 | 7424796 | } | |
| 17738 | 7439715 | } | |
| 17739 | |||
| 17740 |
2/2✓ Branch 0 taken 276 times.
✓ Branch 1 taken 1 times.
|
277 | if (should_skip) |
| 17741 | 1 | return 0; | |
| 17742 | |||
| 17743 |
5/6✓ Branch 0 taken 258 times.
✓ Branch 1 taken 18 times.
✓ Branch 2 taken 5 times.
✓ Branch 3 taken 253 times.
✓ Branch 4 taken 5 times.
✗ Branch 5 not taken.
|
276 | if((version < 0x192)|| ((version == 0x192)&&(build<185))) |
| 17744 | { | ||
| 17745 |
2/2✓ Branch 0 taken 1501440 times.
✓ Branch 1 taken 23 times.
|
1501463 | for(int32_t tmpcounter=0; tmpcounter<MAXCOMBOS; tmpcounter++) |
| 17746 | { | ||
| 17747 |
2/2✓ Branch 0 taken 1501225 times.
✓ Branch 1 taken 215 times.
|
1501440 | if(combobuf[tmpcounter].type==cHOOKSHOTONLY) |
| 17748 | { | ||
| 17749 | 215 | combobuf[tmpcounter].type=cLADDERHOOKSHOT; | |
| 17750 | 215 | } | |
| 17751 | 1501440 | } | |
| 17752 | 23 | } | |
| 17753 | |||
| 17754 | //June 3 2012; ladder only is broken in 2.10 and allows the hookshot also. -Gleeok | ||
| 17755 |
4/6✓ Branch 0 taken 59 times.
✓ Branch 1 taken 217 times.
✓ Branch 2 taken 59 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 59 times.
|
276 | if(version == 0x210 && !is_editor()) |
| 17756 | { | ||
| 17757 |
2/2✓ Branch 0 taken 3851520 times.
✓ Branch 1 taken 59 times.
|
3851579 | for(int32_t tmpcounter=0; tmpcounter<MAXCOMBOS; tmpcounter++) |
| 17758 |
2/2✓ Branch 0 taken 3851335 times.
✓ Branch 1 taken 185 times.
|
3851705 | if(combobuf[tmpcounter].type == cLADDERONLY) |
| 17759 | 185 | combobuf[tmpcounter].type = cLADDERHOOKSHOT; | |
| 17760 | 59 | } | |
| 17761 | |||
| 17762 |
2/2✓ Branch 0 taken 194 times.
✓ Branch 1 taken 82 times.
|
276 | if(section_version<7) |
| 17763 | { | ||
| 17764 |
2/2✓ Branch 0 taken 5352960 times.
✓ Branch 1 taken 82 times.
|
5353042 | for(int32_t tmpcounter=0; tmpcounter<MAXCOMBOS; tmpcounter++) |
| 17765 | { | ||
| 17766 |
6/9✓ Branch 0 taken 5350008 times.
✓ Branch 1 taken 853 times.
✓ Branch 2 taken 791 times.
✓ Branch 3 taken 603 times.
✓ Branch 4 taken 174 times.
✓ Branch 5 taken 531 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
|
5352960 | switch(combobuf[tmpcounter].type) |
| 17767 | { | ||
| 17768 | case cSLASH: | ||
| 17769 | 853 | combobuf[tmpcounter].type=cSLASHTOUCHY; | |
| 17770 | 853 | break; | |
| 17771 | |||
| 17772 | case cSLASHITEM: | ||
| 17773 | 791 | combobuf[tmpcounter].type=cSLASHITEMTOUCHY; | |
| 17774 | 791 | break; | |
| 17775 | |||
| 17776 | case cBUSH: | ||
| 17777 | 603 | combobuf[tmpcounter].type=cBUSHTOUCHY; | |
| 17778 | 603 | break; | |
| 17779 | |||
| 17780 | case cFLOWERS: | ||
| 17781 | 174 | combobuf[tmpcounter].type=cFLOWERSTOUCHY; | |
| 17782 | 174 | break; | |
| 17783 | |||
| 17784 | case cTALLGRASS: | ||
| 17785 | 531 | combobuf[tmpcounter].type=cTALLGRASSTOUCHY; | |
| 17786 | 531 | break; | |
| 17787 | |||
| 17788 | case cSLASHNEXT: | ||
| 17789 | ✗ | combobuf[tmpcounter].type=cSLASHNEXTTOUCHY; | |
| 17790 | ✗ | break; | |
| 17791 | |||
| 17792 | case cSLASHNEXTITEM: | ||
| 17793 | ✗ | combobuf[tmpcounter].type=cSLASHNEXTITEMTOUCHY; | |
| 17794 | ✗ | break; | |
| 17795 | |||
| 17796 | case cBUSHNEXT: | ||
| 17797 | ✗ | combobuf[tmpcounter].type=cBUSHNEXTTOUCHY; | |
| 17798 | ✗ | break; | |
| 17799 | } | ||
| 17800 | 5352960 | } | |
| 17801 | 82 | } | |
| 17802 |
2/2✓ Branch 0 taken 5 times.
✓ Branch 1 taken 271 times.
|
276 | if (section_version < 16) |
| 17803 | { | ||
| 17804 |
2/2✓ Branch 0 taken 17690880 times.
✓ Branch 1 taken 271 times.
|
17691151 | for(int32_t tmpcounter=0; tmpcounter<MAXCOMBOS; tmpcounter++) |
| 17805 | { | ||
| 17806 |
2/2✓ Branch 0 taken 17662235 times.
✓ Branch 1 taken 28645 times.
|
17690880 | if (combobuf[tmpcounter].type == cWATER) |
| 17807 | { | ||
| 17808 | 28645 | combobuf[tmpcounter].attributes[0] = 40000L; | |
| 17809 | 28645 | } | |
| 17810 | 17690880 | } | |
| 17811 | 271 | } | |
| 17812 |
2/2✓ Branch 0 taken 273 times.
✓ Branch 1 taken 3 times.
|
276 | if(!get_qr(qr_ALLOW_EDITING_COMBO_0)) |
| 17813 | { | ||
| 17814 | 3 | combobuf[0].walk = 0xF0; | |
| 17815 | 3 | combobuf[0].type = 0; | |
| 17816 | 3 | combobuf[0].flag = 0; | |
| 17817 | 3 | } | |
| 17818 | |||
| 17819 | //Now for the new combo alias reset | ||
| 17820 |
2/2✓ Branch 0 taken 194 times.
✓ Branch 1 taken 82 times.
|
276 | if(section_version<2) |
| 17821 | { | ||
| 17822 |
2/2✓ Branch 0 taken 671744 times.
✓ Branch 1 taken 82 times.
|
671826 | for(int32_t j=0; j<MAXCOMBOALIASES; j++) |
| 17823 | { | ||
| 17824 | 671744 | combo_aliases[j].width = 0; | |
| 17825 | 671744 | combo_aliases[j].height = 0; | |
| 17826 | 671744 | combo_aliases[j].layermask = 0; | |
| 17827 |
1/2✓ Branch 0 taken 671744 times.
✗ Branch 1 not taken.
|
671744 | combo_aliases[j].combos.clear(); |
| 17828 |
1/2✓ Branch 0 taken 671744 times.
✗ Branch 1 not taken.
|
671744 | combo_aliases[j].csets.clear(); |
| 17829 | 671744 | } | |
| 17830 | 82 | } | |
| 17831 | |||
| 17832 | |||
| 17833 |
1/2✓ Branch 0 taken 276 times.
✗ Branch 1 not taken.
|
276 | setup_combo_animations(); |
| 17834 |
1/2✓ Branch 0 taken 276 times.
✗ Branch 1 not taken.
|
276 | setup_combo_animations2(); |
| 17835 | 276 | return 0; | |
| 17836 | 277 | } | |
| 17837 | 2412301 | int32_t readcombo_loop(PACKFILE* f, word s_version, newcombo& temp_combo) | |
| 17838 | { | ||
| 17839 | byte combo_has_flags; | ||
| 17840 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2412301 times.
|
2412301 | if(!p_getc(&combo_has_flags,f)) |
| 17841 | ✗ | return qe_invalid; | |
| 17842 | |||
| 17843 | 2412301 | temp_combo.clear(); | |
| 17844 |
2/2✓ Branch 0 taken 1679677 times.
✓ Branch 1 taken 732624 times.
|
2412301 | if(combo_has_flags) |
| 17845 | { | ||
| 17846 |
2/2✓ Branch 0 taken 57 times.
✓ Branch 1 taken 732567 times.
|
732624 | if(combo_has_flags&CHAS_BASIC) |
| 17847 | { | ||
| 17848 |
1/2✓ Branch 0 taken 732567 times.
✗ Branch 1 not taken.
|
732567 | if(!p_igetl(&temp_combo.tile,f)) |
| 17849 | ✗ | return qe_invalid; | |
| 17850 | 732567 | temp_combo.o_tile = temp_combo.tile; | |
| 17851 | |||
| 17852 |
1/2✓ Branch 0 taken 732567 times.
✗ Branch 1 not taken.
|
732567 | if(!p_getc(&temp_combo.flip,f)) |
| 17853 | ✗ | return qe_invalid; | |
| 17854 | |||
| 17855 |
1/2✓ Branch 0 taken 732567 times.
✗ Branch 1 not taken.
|
732567 | if(!p_getc(&temp_combo.walk,f)) |
| 17856 | ✗ | return qe_invalid; | |
| 17857 | |||
| 17858 |
1/2✓ Branch 0 taken 732567 times.
✗ Branch 1 not taken.
|
732567 | if(!p_getc(&temp_combo.type,f)) |
| 17859 | ✗ | return qe_invalid; | |
| 17860 | |||
| 17861 |
1/2✓ Branch 0 taken 732567 times.
✗ Branch 1 not taken.
|
732567 | if(!p_getc(&temp_combo.flag,f)) |
| 17862 | ✗ | return qe_invalid; | |
| 17863 | |||
| 17864 |
1/2✓ Branch 0 taken 732567 times.
✗ Branch 1 not taken.
|
732567 | if(!p_getc(&temp_combo.csets,f)) |
| 17865 | ✗ | return qe_invalid; | |
| 17866 | 732567 | } | |
| 17867 |
2/2✓ Branch 0 taken 729809 times.
✓ Branch 1 taken 2815 times.
|
732624 | if(combo_has_flags&CHAS_SCRIPT) |
| 17868 | { | ||
| 17869 |
2/2✓ Branch 0 taken 2785 times.
✓ Branch 1 taken 30 times.
|
2815 | if (s_version>=41) |
| 17870 | { | ||
| 17871 | 2785 | p_getcstr(&temp_combo.label, f); | |
| 17872 | 2785 | } | |
| 17873 | else | ||
| 17874 | { | ||
| 17875 | char label[12]; | ||
| 17876 | 30 | label[11] = '\0'; | |
| 17877 |
2/2✓ Branch 0 taken 330 times.
✓ Branch 1 taken 30 times.
|
360 | for ( int32_t q = 0; q < 11; q++ ) |
| 17878 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 330 times.
|
330 | if(!p_getc(&label[q],f)) |
| 17879 | ✗ | return qe_invalid; | |
| 17880 | 30 | temp_combo.label = label; | |
| 17881 | } | ||
| 17882 | |||
| 17883 |
1/2✓ Branch 0 taken 2815 times.
✗ Branch 1 not taken.
|
2815 | if(!p_igetw(&temp_combo.script,f)) return qe_invalid; |
| 17884 | 2815 | auto initd_count = s_version >= 43 ? 8 : 2; | |
| 17885 |
2/2✓ Branch 0 taken 22340 times.
✓ Branch 1 taken 2815 times.
|
25155 | for ( int32_t q = 0; q < initd_count; q++ ) |
| 17886 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 22340 times.
|
22340 | if(!p_igetl(&temp_combo.initd[q],f)) |
| 17887 | ✗ | return qe_invalid; | |
| 17888 | 2815 | } | |
| 17889 |
2/2✓ Branch 0 taken 580092 times.
✓ Branch 1 taken 152532 times.
|
732624 | if(combo_has_flags&CHAS_ANIM) |
| 17890 | { | ||
| 17891 |
1/2✓ Branch 0 taken 152532 times.
✗ Branch 1 not taken.
|
152532 | if(!p_getc(&temp_combo.frames,f)) |
| 17892 | ✗ | return qe_invalid; | |
| 17893 | |||
| 17894 |
1/2✓ Branch 0 taken 152532 times.
✗ Branch 1 not taken.
|
152532 | if(!p_getc(&temp_combo.speed,f)) |
| 17895 | ✗ | return qe_invalid; | |
| 17896 | |||
| 17897 |
1/2✓ Branch 0 taken 152532 times.
✗ Branch 1 not taken.
|
152532 | if(!p_igetw(&temp_combo.nextcombo,f)) |
| 17898 | ✗ | return qe_invalid; | |
| 17899 | |||
| 17900 |
1/2✓ Branch 0 taken 152532 times.
✗ Branch 1 not taken.
|
152532 | if(!p_getc(&temp_combo.nextcset,f)) |
| 17901 | ✗ | return qe_invalid; | |
| 17902 | |||
| 17903 |
1/2✓ Branch 0 taken 152532 times.
✗ Branch 1 not taken.
|
152532 | if(!p_getc(&temp_combo.skipanim,f)) |
| 17904 | ✗ | return qe_invalid; | |
| 17905 | |||
| 17906 |
1/2✓ Branch 0 taken 152532 times.
✗ Branch 1 not taken.
|
152532 | if(!p_getc(&temp_combo.skipanimy,f)) |
| 17907 | ✗ | return qe_invalid; | |
| 17908 | |||
| 17909 |
1/2✓ Branch 0 taken 152532 times.
✗ Branch 1 not taken.
|
152532 | if(!p_getc(&temp_combo.animflags,f)) |
| 17910 | ✗ | return qe_invalid; | |
| 17911 | 152532 | } | |
| 17912 |
2/2✓ Branch 0 taken 650462 times.
✓ Branch 1 taken 82162 times.
|
732624 | if(combo_has_flags&CHAS_ATTRIB) |
| 17913 | { | ||
| 17914 |
2/2✓ Branch 0 taken 328648 times.
✓ Branch 1 taken 82162 times.
|
410810 | for ( int32_t q = 0; q < 4; q++ ) |
| 17915 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 328648 times.
|
328648 | if(!p_igetl(&temp_combo.attributes[q],f)) |
| 17916 | ✗ | return qe_invalid; | |
| 17917 |
2/2✓ Branch 0 taken 657296 times.
✓ Branch 1 taken 82162 times.
|
739458 | for ( int32_t q = 0; q < 8; q++ ) |
| 17918 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 657296 times.
|
657296 | if(!p_getc(&temp_combo.attribytes[q],f)) |
| 17919 | ✗ | return qe_invalid; | |
| 17920 |
2/2✓ Branch 0 taken 657296 times.
✓ Branch 1 taken 82162 times.
|
739458 | for ( int32_t q = 0; q < 8; q++ ) |
| 17921 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 657296 times.
|
657296 | if(!p_igetw(&temp_combo.attrishorts[q],f)) |
| 17922 | ✗ | return qe_invalid; | |
| 17923 | 82162 | } | |
| 17924 |
2/2✓ Branch 0 taken 704404 times.
✓ Branch 1 taken 28220 times.
|
732624 | if(combo_has_flags&CHAS_FLAG) |
| 17925 | { | ||
| 17926 |
1/2✓ Branch 0 taken 28220 times.
✗ Branch 1 not taken.
|
28220 | if(!p_igetl(&temp_combo.usrflags,f)) |
| 17927 | ✗ | return qe_invalid; | |
| 17928 |
1/2✓ Branch 0 taken 28220 times.
✗ Branch 1 not taken.
|
28220 | if(!p_igetw(&temp_combo.genflags,f)) |
| 17929 | ✗ | return qe_invalid; | |
| 17930 | 28220 | } | |
| 17931 |
2/2✓ Branch 0 taken 715756 times.
✓ Branch 1 taken 16868 times.
|
732624 | if(combo_has_flags&CHAS_TRIG) |
| 17932 | { | ||
| 17933 | 16868 | int numtrigs = s_version < 36 ? 3 : 6; | |
| 17934 |
2/2✓ Branch 0 taken 100350 times.
✓ Branch 1 taken 16868 times.
|
117218 | for ( int32_t q = 0; q < numtrigs; q++ ) |
| 17935 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 100350 times.
|
100350 | if(!p_igetl(&temp_combo.triggerflags[q],f)) |
| 17936 | ✗ | return qe_invalid; | |
| 17937 |
1/2✓ Branch 0 taken 16868 times.
✗ Branch 1 not taken.
|
16868 | if(!p_igetl(&temp_combo.triggerlevel,f)) |
| 17938 | ✗ | return qe_invalid; | |
| 17939 |
1/2✓ Branch 0 taken 16868 times.
✗ Branch 1 not taken.
|
16868 | if(!p_getc(&temp_combo.triggerbtn,f)) |
| 17940 | ✗ | return qe_invalid; | |
| 17941 |
1/2✓ Branch 0 taken 16868 times.
✗ Branch 1 not taken.
|
16868 | if(!p_getc(&temp_combo.triggeritem,f)) |
| 17942 | ✗ | return qe_invalid; | |
| 17943 |
1/2✓ Branch 0 taken 16868 times.
✗ Branch 1 not taken.
|
16868 | if(!p_getc(&temp_combo.trigtimer,f)) |
| 17944 | ✗ | return qe_invalid; | |
| 17945 |
1/2✓ Branch 0 taken 16868 times.
✗ Branch 1 not taken.
|
16868 | if(!p_getc(&temp_combo.trigsfx,f)) |
| 17946 | ✗ | return qe_invalid; | |
| 17947 |
1/2✓ Branch 0 taken 16868 times.
✗ Branch 1 not taken.
|
16868 | if(!p_igetl(&temp_combo.trigchange,f)) |
| 17948 | ✗ | return qe_invalid; | |
| 17949 |
1/2✓ Branch 0 taken 16868 times.
✗ Branch 1 not taken.
|
16868 | if(!p_igetw(&temp_combo.trigprox,f)) |
| 17950 | ✗ | return qe_invalid; | |
| 17951 |
1/2✓ Branch 0 taken 16868 times.
✗ Branch 1 not taken.
|
16868 | if(!p_getc(&temp_combo.trigctr,f)) |
| 17952 | ✗ | return qe_invalid; | |
| 17953 |
1/2✓ Branch 0 taken 16868 times.
✗ Branch 1 not taken.
|
16868 | if(!p_igetl(&temp_combo.trigctramnt,f)) |
| 17954 | ✗ | return qe_invalid; | |
| 17955 |
1/2✓ Branch 0 taken 16868 times.
✗ Branch 1 not taken.
|
16868 | if(!p_getc(&temp_combo.triglbeam,f)) |
| 17956 | ✗ | return qe_invalid; | |
| 17957 |
1/2✓ Branch 0 taken 16868 times.
✗ Branch 1 not taken.
|
16868 | if(!p_getc(&temp_combo.trigcschange,f)) |
| 17958 | ✗ | return qe_invalid; | |
| 17959 |
1/2✓ Branch 0 taken 16868 times.
✗ Branch 1 not taken.
|
16868 | if(!p_igetw(&temp_combo.spawnitem,f)) |
| 17960 | ✗ | return qe_invalid; | |
| 17961 |
1/2✓ Branch 0 taken 16868 times.
✗ Branch 1 not taken.
|
16868 | if(!p_igetw(&temp_combo.spawnenemy,f)) |
| 17962 | ✗ | return qe_invalid; | |
| 17963 |
1/2✓ Branch 0 taken 16868 times.
✗ Branch 1 not taken.
|
16868 | if(!p_getc(&temp_combo.exstate,f)) |
| 17964 | ✗ | return qe_invalid; | |
| 17965 |
1/2✓ Branch 0 taken 16868 times.
✗ Branch 1 not taken.
|
16868 | if(!p_igetl(&temp_combo.spawnip,f)) |
| 17966 | ✗ | return qe_invalid; | |
| 17967 |
1/2✓ Branch 0 taken 16868 times.
✗ Branch 1 not taken.
|
16868 | if(!p_getc(&temp_combo.trigcopycat,f)) |
| 17968 | ✗ | return qe_invalid; | |
| 17969 |
1/2✓ Branch 0 taken 16868 times.
✗ Branch 1 not taken.
|
16868 | if(!p_getc(&temp_combo.trigcooldown,f)) |
| 17970 | ✗ | return qe_invalid; | |
| 17971 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 16868 times.
|
16868 | if(s_version >= 35) |
| 17972 | { | ||
| 17973 |
1/2✓ Branch 0 taken 16868 times.
✗ Branch 1 not taken.
|
16868 | if(!p_igetw(&temp_combo.prompt_cid,f)) |
| 17974 | ✗ | return qe_invalid; | |
| 17975 |
1/2✓ Branch 0 taken 16868 times.
✗ Branch 1 not taken.
|
16868 | if(!p_getc(&temp_combo.prompt_cs,f)) |
| 17976 | ✗ | return qe_invalid; | |
| 17977 |
1/2✓ Branch 0 taken 16868 times.
✗ Branch 1 not taken.
|
16868 | if(!p_igetw(&temp_combo.prompt_x,f)) |
| 17978 | ✗ | return qe_invalid; | |
| 17979 |
1/2✓ Branch 0 taken 16868 times.
✗ Branch 1 not taken.
|
16868 | if(!p_igetw(&temp_combo.prompt_y,f)) |
| 17980 | ✗ | return qe_invalid; | |
| 17981 | 16868 | } | |
| 17982 |
2/2✓ Branch 0 taken 286 times.
✓ Branch 1 taken 16582 times.
|
16868 | if(s_version >= 36) |
| 17983 | { | ||
| 17984 |
1/2✓ Branch 0 taken 16582 times.
✗ Branch 1 not taken.
|
16582 | if(!p_getc(&temp_combo.trig_lstate,f)) |
| 17985 | ✗ | return qe_invalid; | |
| 17986 |
1/2✓ Branch 0 taken 16582 times.
✗ Branch 1 not taken.
|
16582 | if(!p_getc(&temp_combo.trig_gstate,f)) |
| 17987 | ✗ | return qe_invalid; | |
| 17988 |
1/2✓ Branch 0 taken 16582 times.
✗ Branch 1 not taken.
|
16582 | if(!p_igetl(&temp_combo.trig_statetime,f)) |
| 17989 | ✗ | return qe_invalid; | |
| 17990 | 16582 | } | |
| 17991 |
2/2✓ Branch 0 taken 286 times.
✓ Branch 1 taken 16582 times.
|
16868 | if(s_version >= 37) |
| 17992 | { | ||
| 17993 |
1/2✓ Branch 0 taken 16582 times.
✗ Branch 1 not taken.
|
16582 | if(!p_igetw(&temp_combo.trig_genscr,f)) |
| 17994 | ✗ | return qe_invalid; | |
| 17995 | 16582 | } | |
| 17996 |
2/2✓ Branch 0 taken 434 times.
✓ Branch 1 taken 16434 times.
|
16868 | if(s_version >= 38) |
| 17997 | { | ||
| 17998 |
1/2✓ Branch 0 taken 16434 times.
✗ Branch 1 not taken.
|
16434 | if(!p_getc(&temp_combo.trig_group,f)) |
| 17999 | ✗ | return qe_invalid; | |
| 18000 |
1/2✓ Branch 0 taken 16434 times.
✗ Branch 1 not taken.
|
16434 | if(!p_igetw(&temp_combo.trig_group_val,f)) |
| 18001 | ✗ | return qe_invalid; | |
| 18002 | 16434 | } | |
| 18003 |
2/2✓ Branch 0 taken 479 times.
✓ Branch 1 taken 16389 times.
|
16868 | if(s_version >= 45) |
| 18004 | { | ||
| 18005 |
1/2✓ Branch 0 taken 16389 times.
✗ Branch 1 not taken.
|
16389 | if(!p_getc(&temp_combo.exdoor_dir,f)) |
| 18006 | ✗ | return qe_invalid; | |
| 18007 |
1/2✓ Branch 0 taken 16389 times.
✗ Branch 1 not taken.
|
16389 | if(!p_getc(&temp_combo.exdoor_ind,f)) |
| 18008 | ✗ | return qe_invalid; | |
| 18009 | 16389 | } | |
| 18010 |
2/2✓ Branch 0 taken 12766 times.
✓ Branch 1 taken 4102 times.
|
16868 | if(s_version >= 46) |
| 18011 | { | ||
| 18012 |
1/2✓ Branch 0 taken 4102 times.
✗ Branch 1 not taken.
|
4102 | if(!p_getc(&temp_combo.trig_levelitems,f)) |
| 18013 | ✗ | return qe_invalid; | |
| 18014 |
1/2✓ Branch 0 taken 4102 times.
✗ Branch 1 not taken.
|
4102 | if(!p_igetw(&temp_combo.trigdmlevel,f)) |
| 18015 | ✗ | return qe_invalid; | |
| 18016 |
2/2✓ Branch 0 taken 12306 times.
✓ Branch 1 taken 4102 times.
|
16408 | for(int q = 0; q < 3; ++q) |
| 18017 |
1/2✓ Branch 0 taken 12306 times.
✗ Branch 1 not taken.
|
12306 | if(!p_getc(&temp_combo.trigtint[q],f)) |
| 18018 | ✗ | return qe_invalid; | |
| 18019 |
1/2✓ Branch 0 taken 4102 times.
✗ Branch 1 not taken.
|
4102 | if(!p_igetw(&temp_combo.triglvlpalette,f)) |
| 18020 | ✗ | return qe_invalid; | |
| 18021 |
1/2✓ Branch 0 taken 4102 times.
✗ Branch 1 not taken.
|
4102 | if(!p_igetw(&temp_combo.trigbosspalette,f)) |
| 18022 | ✗ | return qe_invalid; | |
| 18023 |
1/2✓ Branch 0 taken 4102 times.
✗ Branch 1 not taken.
|
4102 | if(!p_igetw(&temp_combo.trigquaketime,f)) |
| 18024 | ✗ | return qe_invalid; | |
| 18025 |
1/2✓ Branch 0 taken 4102 times.
✗ Branch 1 not taken.
|
4102 | if(!p_igetw(&temp_combo.trigwavytime,f)) |
| 18026 | ✗ | return qe_invalid; | |
| 18027 |
1/2✓ Branch 0 taken 4102 times.
✗ Branch 1 not taken.
|
4102 | if(!p_igetw(&temp_combo.trig_swjinxtime,f)) |
| 18028 | ✗ | return qe_invalid; | |
| 18029 |
1/2✓ Branch 0 taken 4102 times.
✗ Branch 1 not taken.
|
4102 | if(!p_igetw(&temp_combo.trig_itmjinxtime,f)) |
| 18030 | ✗ | return qe_invalid; | |
| 18031 |
1/2✓ Branch 0 taken 4102 times.
✗ Branch 1 not taken.
|
4102 | if(!p_igetw(&temp_combo.trig_stuntime,f)) |
| 18032 | ✗ | return qe_invalid; | |
| 18033 |
1/2✓ Branch 0 taken 4102 times.
✗ Branch 1 not taken.
|
4102 | if(!p_igetw(&temp_combo.trig_bunnytime,f)) |
| 18034 | ✗ | return qe_invalid; | |
| 18035 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4102 times.
|
4102 | if(!p_getc(&temp_combo.trig_pushtime,f)) |
| 18036 | ✗ | return qe_invalid; | |
| 18037 | 4102 | } | |
| 18038 | 16868 | } | |
| 18039 |
2/2✓ Branch 0 taken 730487 times.
✓ Branch 1 taken 2137 times.
|
732624 | if(combo_has_flags&CHAS_LIFT) |
| 18040 | { | ||
| 18041 |
1/2✓ Branch 0 taken 2137 times.
✗ Branch 1 not taken.
|
2137 | if(!p_igetw(&temp_combo.liftcmb,f)) |
| 18042 | ✗ | return qe_invalid; | |
| 18043 |
1/2✓ Branch 0 taken 2137 times.
✗ Branch 1 not taken.
|
2137 | if(!p_getc(&temp_combo.liftcs,f)) |
| 18044 | ✗ | return qe_invalid; | |
| 18045 |
1/2✓ Branch 0 taken 2137 times.
✗ Branch 1 not taken.
|
2137 | if(!p_igetw(&temp_combo.liftundercmb,f)) |
| 18046 | ✗ | return qe_invalid; | |
| 18047 |
1/2✓ Branch 0 taken 2137 times.
✗ Branch 1 not taken.
|
2137 | if(!p_getc(&temp_combo.liftundercs,f)) |
| 18048 | ✗ | return qe_invalid; | |
| 18049 |
1/2✓ Branch 0 taken 2137 times.
✗ Branch 1 not taken.
|
2137 | if(!p_getc(&temp_combo.liftdmg,f)) |
| 18050 | ✗ | return qe_invalid; | |
| 18051 |
1/2✓ Branch 0 taken 2137 times.
✗ Branch 1 not taken.
|
2137 | if(!p_getc(&temp_combo.liftlvl,f)) |
| 18052 | ✗ | return qe_invalid; | |
| 18053 |
1/2✓ Branch 0 taken 2137 times.
✗ Branch 1 not taken.
|
2137 | if(!p_getc(&temp_combo.liftitm,f)) |
| 18054 | ✗ | return qe_invalid; | |
| 18055 |
1/2✓ Branch 0 taken 2137 times.
✗ Branch 1 not taken.
|
2137 | if(!p_getc(&temp_combo.liftflags,f)) |
| 18056 | ✗ | return qe_invalid; | |
| 18057 |
1/2✓ Branch 0 taken 2137 times.
✗ Branch 1 not taken.
|
2137 | if(!p_getc(&temp_combo.liftgfx,f)) |
| 18058 | ✗ | return qe_invalid; | |
| 18059 |
1/2✓ Branch 0 taken 2137 times.
✗ Branch 1 not taken.
|
2137 | if(!p_getc(&temp_combo.liftsprite,f)) |
| 18060 | ✗ | return qe_invalid; | |
| 18061 |
1/2✓ Branch 0 taken 2137 times.
✗ Branch 1 not taken.
|
2137 | if(!p_getc(&temp_combo.liftsfx,f)) |
| 18062 | ✗ | return qe_invalid; | |
| 18063 |
1/2✓ Branch 0 taken 2137 times.
✗ Branch 1 not taken.
|
2137 | if(!p_igetw(&temp_combo.liftbreaksprite,f)) |
| 18064 | ✗ | return qe_invalid; | |
| 18065 |
1/2✓ Branch 0 taken 2137 times.
✗ Branch 1 not taken.
|
2137 | if(!p_getc(&temp_combo.liftbreaksfx,f)) |
| 18066 | ✗ | return qe_invalid; | |
| 18067 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2137 times.
|
2137 | if(s_version >= 34) |
| 18068 | { | ||
| 18069 |
1/2✓ Branch 0 taken 2137 times.
✗ Branch 1 not taken.
|
2137 | if(!p_getc(&temp_combo.lifthei,f)) |
| 18070 | ✗ | return qe_invalid; | |
| 18071 |
1/2✓ Branch 0 taken 2137 times.
✗ Branch 1 not taken.
|
2137 | if(!p_getc(&temp_combo.lifttime,f)) |
| 18072 | ✗ | return qe_invalid; | |
| 18073 | 2137 | } | |
| 18074 |
2/2✓ Branch 0 taken 14 times.
✓ Branch 1 taken 2123 times.
|
2137 | if(s_version >= 39) |
| 18075 | { | ||
| 18076 |
1/2✓ Branch 0 taken 2123 times.
✗ Branch 1 not taken.
|
2123 | if(!p_getc(&temp_combo.lift_parent_item,f)) |
| 18077 | ✗ | return qe_invalid; | |
| 18078 | 2123 | } | |
| 18079 | 2137 | } | |
| 18080 |
2/2✓ Branch 0 taken 731316 times.
✓ Branch 1 taken 1308 times.
|
732624 | if(combo_has_flags&CHAS_GENERAL) |
| 18081 | { | ||
| 18082 |
1/2✓ Branch 0 taken 1308 times.
✗ Branch 1 not taken.
|
1308 | if(!p_getc(&temp_combo.speed_mult,f)) |
| 18083 | ✗ | return qe_invalid; | |
| 18084 |
1/2✓ Branch 0 taken 1308 times.
✗ Branch 1 not taken.
|
1308 | if(!p_getc(&temp_combo.speed_div,f)) |
| 18085 | ✗ | return qe_invalid; | |
| 18086 |
1/2✓ Branch 0 taken 1308 times.
✗ Branch 1 not taken.
|
1308 | if(!p_igetzf(&temp_combo.speed_add,f)) |
| 18087 | ✗ | return qe_invalid; | |
| 18088 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1308 times.
|
1308 | if(s_version >= 42) |
| 18089 | { | ||
| 18090 |
1/2✓ Branch 0 taken 1308 times.
✗ Branch 1 not taken.
|
1308 | if(!p_getc(&temp_combo.sfx_appear,f)) |
| 18091 | ✗ | return qe_invalid; | |
| 18092 |
1/2✓ Branch 0 taken 1308 times.
✗ Branch 1 not taken.
|
1308 | if(!p_getc(&temp_combo.sfx_disappear,f)) |
| 18093 | ✗ | return qe_invalid; | |
| 18094 |
1/2✓ Branch 0 taken 1308 times.
✗ Branch 1 not taken.
|
1308 | if(!p_getc(&temp_combo.sfx_loop,f)) |
| 18095 | ✗ | return qe_invalid; | |
| 18096 |
1/2✓ Branch 0 taken 1308 times.
✗ Branch 1 not taken.
|
1308 | if(!p_getc(&temp_combo.sfx_walking,f)) |
| 18097 | ✗ | return qe_invalid; | |
| 18098 |
1/2✓ Branch 0 taken 1308 times.
✗ Branch 1 not taken.
|
1308 | if(!p_getc(&temp_combo.sfx_standing,f)) |
| 18099 | ✗ | return qe_invalid; | |
| 18100 |
1/2✓ Branch 0 taken 1308 times.
✗ Branch 1 not taken.
|
1308 | if(!p_getc(&temp_combo.spr_appear,f)) |
| 18101 | ✗ | return qe_invalid; | |
| 18102 |
1/2✓ Branch 0 taken 1308 times.
✗ Branch 1 not taken.
|
1308 | if(!p_getc(&temp_combo.spr_disappear,f)) |
| 18103 | ✗ | return qe_invalid; | |
| 18104 |
1/2✓ Branch 0 taken 1308 times.
✗ Branch 1 not taken.
|
1308 | if(!p_getc(&temp_combo.spr_walking,f)) |
| 18105 | ✗ | return qe_invalid; | |
| 18106 |
1/2✓ Branch 0 taken 1308 times.
✗ Branch 1 not taken.
|
1308 | if(!p_getc(&temp_combo.spr_standing,f)) |
| 18107 | ✗ | return qe_invalid; | |
| 18108 | 1308 | } | |
| 18109 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1308 times.
|
1308 | if(s_version >= 44) |
| 18110 | { | ||
| 18111 |
1/2✓ Branch 0 taken 1308 times.
✗ Branch 1 not taken.
|
1308 | if(!p_getc(&temp_combo.sfx_tap,f)) |
| 18112 | ✗ | return qe_invalid; | |
| 18113 | 1308 | } | |
| 18114 | 1308 | } | |
| 18115 | 732624 | } | |
| 18116 | 2412301 | update_combo(temp_combo, s_version); | |
| 18117 | 2412301 | return 0; | |
| 18118 | 2412301 | } | |
| 18119 | 695 | int32_t readcombos(PACKFILE *f, zquestheader *Header, word version, word build, word start_combo, word max_combos) | |
| 18120 | { | ||
| 18121 |
2/2✓ Branch 0 taken 671 times.
✓ Branch 1 taken 24 times.
|
695 | bool should_skip = legacy_skip_flags && get_bit(legacy_skip_flags, skip_combos); |
| 18122 | |||
| 18123 | 695 | word section_version=0; | |
| 18124 | 695 | word section_cversion=0; | |
| 18125 | 695 | word combos_used=0; | |
| 18126 | int32_t dummy; | ||
| 18127 | byte padding; | ||
| 18128 | 695 | newcombo temp_combo; | |
| 18129 | |||
| 18130 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 694 times.
|
695 | if (!should_skip) |
| 18131 | { | ||
| 18132 |
1/2✓ Branch 0 taken 694 times.
✗ Branch 1 not taken.
|
694 | reset_combo_animations(); |
| 18133 |
1/2✓ Branch 0 taken 694 times.
✗ Branch 1 not taken.
|
694 | reset_combo_animations2(); |
| 18134 |
1/2✓ Branch 0 taken 694 times.
✗ Branch 1 not taken.
|
694 | init_combo_classes(); |
| 18135 | |||
| 18136 |
2/2✓ Branch 0 taken 45304320 times.
✓ Branch 1 taken 694 times.
|
45305014 | for(int32_t q = start_combo; q < start_combo+max_combos; ++q) |
| 18137 |
1/2✓ Branch 0 taken 45304320 times.
✗ Branch 1 not taken.
|
45304320 | combobuf[q].clear(); |
| 18138 | 694 | } | |
| 18139 | |||
| 18140 |
2/2✓ Branch 0 taken 671 times.
✓ Branch 1 taken 24 times.
|
695 | if(version > 0x192) //Version info |
| 18141 | { | ||
| 18142 |
2/4✓ Branch 0 taken 671 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 671 times.
✗ Branch 3 not taken.
|
671 | if(!p_igetw(§ion_version,f)) |
| 18143 | { | ||
| 18144 | ✗ | return qe_invalid; | |
| 18145 | } | ||
| 18146 | 671 | FFCore.quest_format[vCombos] = section_version; | |
| 18147 |
2/4✓ Branch 0 taken 671 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 671 times.
✗ Branch 3 not taken.
|
671 | if(!p_igetw(§ion_cversion,f)) |
| 18148 | { | ||
| 18149 | ✗ | return qe_invalid; | |
| 18150 | } | ||
| 18151 | |||
| 18152 | //section size | ||
| 18153 |
2/4✓ Branch 0 taken 671 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 671 times.
✗ Branch 3 not taken.
|
671 | if(!p_igetl(&dummy,f)) |
| 18154 | { | ||
| 18155 | ✗ | return qe_invalid; | |
| 18156 | } | ||
| 18157 | 671 | } | |
| 18158 | |||
| 18159 |
2/2✓ Branch 0 taken 418 times.
✓ Branch 1 taken 277 times.
|
695 | if(section_version > 32) //Cleanup time! |
| 18160 | { | ||
| 18161 |
2/4✓ Branch 0 taken 418 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 418 times.
✗ Branch 3 not taken.
|
418 | if(!p_igetw(&combos_used,f)) |
| 18162 | { | ||
| 18163 | ✗ | return qe_invalid; | |
| 18164 | } | ||
| 18165 |
2/2✓ Branch 0 taken 2412301 times.
✓ Branch 1 taken 418 times.
|
2412719 | for(int32_t i=0; i<combos_used; i++) |
| 18166 | { | ||
| 18167 |
1/2✓ Branch 0 taken 2412301 times.
✗ Branch 1 not taken.
|
2412301 | auto ret = readcombo_loop(f,section_version,temp_combo); |
| 18168 |
1/2✓ Branch 0 taken 2412301 times.
✗ Branch 1 not taken.
|
2412301 | if(ret) return ret; |
| 18169 |
1/2✓ Branch 0 taken 2412301 times.
✗ Branch 1 not taken.
|
2412301 | if(i>=start_combo) |
| 18170 | { | ||
| 18171 |
1/2✓ Branch 0 taken 2412301 times.
✗ Branch 1 not taken.
|
2412301 | if(loading_tileset_flags & TILESET_CLEARSCRIPTS) |
| 18172 | { | ||
| 18173 | ✗ | temp_combo.script = 0; | |
| 18174 | ✗ | for(int q = 0; q < 8; ++q) | |
| 18175 | ✗ | temp_combo.initd[q] = 0; | |
| 18176 | ✗ | } | |
| 18177 |
1/2✓ Branch 0 taken 2412301 times.
✗ Branch 1 not taken.
|
2412301 | combobuf[i] = temp_combo; |
| 18178 | 2412301 | } | |
| 18179 | 2412301 | } | |
| 18180 | 418 | } | |
| 18181 | else //Call the old function for all old versions | ||
| 18182 | { | ||
| 18183 |
1/2✓ Branch 0 taken 277 times.
✗ Branch 1 not taken.
|
277 | auto ret = readcombos_old(section_version,f,Header,version,build,start_combo,max_combos); |
| 18184 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 277 times.
|
277 | if(ret) return ret; //error, end read |
| 18185 | } | ||
| 18186 | |||
| 18187 |
2/2✓ Branch 0 taken 694 times.
✓ Branch 1 taken 1 times.
|
695 | if (should_skip) |
| 18188 | 1 | return 0; | |
| 18189 | |||
| 18190 |
2/2✓ Branch 0 taken 283 times.
✓ Branch 1 taken 411 times.
|
694 | if(!get_qr(qr_ALLOW_EDITING_COMBO_0)) |
| 18191 | { | ||
| 18192 | 411 | combobuf[0].walk = 0xF0; | |
| 18193 | 411 | combobuf[0].type = 0; | |
| 18194 | 411 | combobuf[0].flag = 0; | |
| 18195 | 411 | } | |
| 18196 | |||
| 18197 |
1/2✓ Branch 0 taken 694 times.
✗ Branch 1 not taken.
|
694 | setup_combo_animations(); |
| 18198 |
1/2✓ Branch 0 taken 694 times.
✗ Branch 1 not taken.
|
694 | setup_combo_animations2(); |
| 18199 | 694 | return 0; | |
| 18200 | 695 | } | |
| 18201 | |||
| 18202 | 612 | int32_t readcomboaliases(PACKFILE *f, zquestheader *Header, word version, word build) | |
| 18203 | { | ||
| 18204 | //these are here to bypass compiler warnings about unused arguments | ||
| 18205 | 612 | Header=Header; | |
| 18206 | 612 | version=version; | |
| 18207 | 612 | build=build; | |
| 18208 | |||
| 18209 | int32_t dummy; | ||
| 18210 | 612 | word sversion=0, c_sversion; | |
| 18211 | |||
| 18212 | //section version info | ||
| 18213 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 612 times.
|
612 | if(!p_igetw(&sversion,f)) |
| 18214 | { | ||
| 18215 | ✗ | return qe_invalid; | |
| 18216 | } | ||
| 18217 | |||
| 18218 | 612 | FFCore.quest_format[vComboAliases] = sversion; | |
| 18219 | |||
| 18220 | //al_trace("Combo aliases version %d\n", sversion); | ||
| 18221 |
1/2✓ Branch 0 taken 612 times.
✗ Branch 1 not taken.
|
612 | if(!p_igetw(&c_sversion,f)) |
| 18222 | { | ||
| 18223 | ✗ | return qe_invalid; | |
| 18224 | } | ||
| 18225 | |||
| 18226 | //section size | ||
| 18227 |
1/2✓ Branch 0 taken 612 times.
✗ Branch 1 not taken.
|
612 | if(!p_igetl(&dummy,f)) |
| 18228 | { | ||
| 18229 | ✗ | return qe_invalid; | |
| 18230 | } | ||
| 18231 | |||
| 18232 | 612 | int32_t max_num_combo_aliases = MAXCOMBOALIASES; | |
| 18233 | |||
| 18234 |
2/2✓ Branch 0 taken 423 times.
✓ Branch 1 taken 189 times.
|
612 | if(sversion < 3) // max saved combo alias' upped from 256 to 2048. |
| 18235 | { | ||
| 18236 | 189 | max_num_combo_aliases = MAX250COMBOALIASES; | |
| 18237 | 189 | } | |
| 18238 |
1/2✓ Branch 0 taken 612 times.
✗ Branch 1 not taken.
|
612 | if(sversion < 2) // max saved combo alias' upped from 256 to 2048. |
| 18239 | { | ||
| 18240 | ✗ | max_num_combo_aliases = OLDMAXCOMBOALIASES; | |
| 18241 | ✗ | } | |
| 18242 | |||
| 18243 |
2/2✓ Branch 0 taken 3852288 times.
✓ Branch 1 taken 612 times.
|
3852900 | for(int32_t j=0; j<max_num_combo_aliases; j++) |
| 18244 | { | ||
| 18245 | byte width,height,mask,tempcset; | ||
| 18246 | int32_t count; | ||
| 18247 | word tempword; | ||
| 18248 | byte tempbyte; | ||
| 18249 | |||
| 18250 |
1/2✓ Branch 0 taken 3852288 times.
✗ Branch 1 not taken.
|
3852288 | if(!p_igetw(&tempword,f)) |
| 18251 | { | ||
| 18252 | ✗ | return qe_invalid; | |
| 18253 | } | ||
| 18254 | |||
| 18255 | 3852288 | combo_aliases[j].combo = tempword; | |
| 18256 | |||
| 18257 |
1/2✓ Branch 0 taken 3852288 times.
✗ Branch 1 not taken.
|
3852288 | if(!p_getc(&tempbyte,f)) |
| 18258 | { | ||
| 18259 | ✗ | return qe_invalid; | |
| 18260 | } | ||
| 18261 | |||
| 18262 | 3852288 | combo_aliases[j].cset = tempbyte; | |
| 18263 | |||
| 18264 |
1/2✓ Branch 0 taken 3852288 times.
✗ Branch 1 not taken.
|
3852288 | if(!p_getc(&width,f)) |
| 18265 | { | ||
| 18266 | ✗ | return qe_invalid; | |
| 18267 | } | ||
| 18268 | |||
| 18269 |
1/2✓ Branch 0 taken 3852288 times.
✗ Branch 1 not taken.
|
3852288 | if(!p_getc(&height,f)) |
| 18270 | { | ||
| 18271 | ✗ | return qe_invalid; | |
| 18272 | } | ||
| 18273 | |||
| 18274 |
1/2✓ Branch 0 taken 3852288 times.
✗ Branch 1 not taken.
|
3852288 | if(!p_getc(&mask,f)) |
| 18275 | { | ||
| 18276 | ✗ | return qe_invalid; | |
| 18277 | } | ||
| 18278 | |||
| 18279 | 3852288 | count=(width+1)*(height+1)*(comboa_lmasktotal(mask)+1); | |
| 18280 | |||
| 18281 | 3852288 | combo_aliases[j].width = width; | |
| 18282 | 3852288 | combo_aliases[j].height = height; | |
| 18283 | 3852288 | combo_aliases[j].layermask = mask; | |
| 18284 | 3852288 | combo_aliases[j].combos.clear(); | |
| 18285 | 3852288 | combo_aliases[j].csets.clear(); | |
| 18286 | |||
| 18287 |
2/2✓ Branch 0 taken 3960704 times.
✓ Branch 1 taken 3852288 times.
|
7812992 | for(int32_t k=0; k<count; k++) |
| 18288 | { | ||
| 18289 |
1/2✓ Branch 0 taken 3960704 times.
✗ Branch 1 not taken.
|
3960704 | if(!p_igetw(&tempword,f)) |
| 18290 | { | ||
| 18291 | ✗ | return qe_invalid; | |
| 18292 | } | ||
| 18293 | |||
| 18294 | 3960704 | combo_aliases[j].combos[k] = tempword; | |
| 18295 | 3960704 | } | |
| 18296 | |||
| 18297 |
2/2✓ Branch 0 taken 3960704 times.
✓ Branch 1 taken 3852288 times.
|
7812992 | for(int32_t k=0; k<count; k++) |
| 18298 | { | ||
| 18299 |
1/2✓ Branch 0 taken 3960704 times.
✗ Branch 1 not taken.
|
3960704 | if(!p_getc(&tempcset,f)) |
| 18300 | { | ||
| 18301 | ✗ | return qe_invalid; | |
| 18302 | } | ||
| 18303 | |||
| 18304 | 3960704 | combo_aliases[j].csets[k] = tempcset; | |
| 18305 | 3960704 | } | |
| 18306 | 3852288 | } | |
| 18307 | |||
| 18308 | //Combo pools! | ||
| 18309 | 612 | word num_combo_pools = 0; | |
| 18310 |
2/2✓ Branch 0 taken 194 times.
✓ Branch 1 taken 418 times.
|
612 | if(sversion >= 4) |
| 18311 | { | ||
| 18312 |
1/2✓ Branch 0 taken 418 times.
✗ Branch 1 not taken.
|
418 | if(!p_igetw(&num_combo_pools,f)) |
| 18313 | { | ||
| 18314 | ✗ | return qe_invalid; | |
| 18315 | } | ||
| 18316 | 418 | } | |
| 18317 | |||
| 18318 |
2/2✓ Branch 0 taken 5013504 times.
✓ Branch 1 taken 612 times.
|
5014116 | for(combo_pool& pool : combo_pools) |
| 18319 | { | ||
| 18320 | 5013504 | pool.clear(); | |
| 18321 | } | ||
| 18322 | |||
| 18323 | 612 | combo_pool temp_cpool; | |
| 18324 |
2/2✓ Branch 0 taken 1278 times.
✓ Branch 1 taken 612 times.
|
1890 | for(word cp = 0; cp < num_combo_pools; ++cp) |
| 18325 | { | ||
| 18326 | 1278 | int32_t num_combos_in_pool = 0; | |
| 18327 |
2/4✓ Branch 0 taken 1278 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1278 times.
✗ Branch 3 not taken.
|
1278 | if(!p_igetl(&num_combos_in_pool,f)) |
| 18328 | { | ||
| 18329 | ✗ | return qe_invalid; | |
| 18330 | } | ||
| 18331 |
2/2✓ Branch 0 taken 1182 times.
✓ Branch 1 taken 96 times.
|
1278 | if(num_combos_in_pool < 1) continue; //nothing to read |
| 18332 | |||
| 18333 |
1/2✓ Branch 0 taken 1182 times.
✗ Branch 1 not taken.
|
1182 | temp_cpool.clear(); |
| 18334 | |||
| 18335 | int32_t cp_cid; int8_t cp_cs; word cp_quant; | ||
| 18336 |
2/2✓ Branch 0 taken 1182 times.
✓ Branch 1 taken 5190 times.
|
6372 | for(auto q = 0; q < num_combos_in_pool; ++q) |
| 18337 | { | ||
| 18338 |
2/4✓ Branch 0 taken 5190 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 5190 times.
✗ Branch 3 not taken.
|
5190 | if(!p_igetl(&cp_cid,f)) |
| 18339 | { | ||
| 18340 | ✗ | return qe_invalid; | |
| 18341 | } | ||
| 18342 |
2/4✓ Branch 0 taken 5190 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 5190 times.
✗ Branch 3 not taken.
|
5190 | if(!p_getc(&cp_cs,f)) |
| 18343 | { | ||
| 18344 | ✗ | return qe_invalid; | |
| 18345 | } | ||
| 18346 |
2/4✓ Branch 0 taken 5190 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 5190 times.
✗ Branch 3 not taken.
|
5190 | if(!p_igetw(&cp_quant,f)) |
| 18347 | { | ||
| 18348 | ✗ | return qe_invalid; | |
| 18349 | } | ||
| 18350 |
1/2✓ Branch 0 taken 5190 times.
✗ Branch 1 not taken.
|
5190 | temp_cpool.add(cp_cid, cp_cs, cp_quant); |
| 18351 | 5190 | } | |
| 18352 | |||
| 18353 |
1/2✓ Branch 0 taken 1182 times.
✗ Branch 1 not taken.
|
1182 | combo_pools[cp] = temp_cpool; |
| 18354 | 1182 | } | |
| 18355 | |||
| 18356 | //Autocombos! | ||
| 18357 | 612 | word num_combo_autos = 0; | |
| 18358 |
2/2✓ Branch 0 taken 405 times.
✓ Branch 1 taken 207 times.
|
612 | if (sversion >= 5) |
| 18359 | { | ||
| 18360 |
2/4✓ Branch 0 taken 405 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 405 times.
✗ Branch 3 not taken.
|
405 | if (!p_igetw(&num_combo_autos, f)) |
| 18361 | { | ||
| 18362 | ✗ | return qe_invalid; | |
| 18363 | } | ||
| 18364 | 405 | } | |
| 18365 | |||
| 18366 |
2/2✓ Branch 0 taken 612 times.
✓ Branch 1 taken 5013504 times.
|
5014116 | for (combo_auto& cauto : combo_autos) |
| 18367 | { | ||
| 18368 |
1/2✓ Branch 0 taken 5013504 times.
✗ Branch 1 not taken.
|
5013504 | cauto.clear(true); |
| 18369 | } | ||
| 18370 | |||
| 18371 |
1/2✓ Branch 0 taken 612 times.
✗ Branch 1 not taken.
|
612 | combo_auto temp_cauto; |
| 18372 |
2/2✓ Branch 0 taken 894 times.
✓ Branch 1 taken 612 times.
|
1506 | for (word ca = 0; ca < num_combo_autos; ++ca) |
| 18373 | { | ||
| 18374 | byte type; | ||
| 18375 | int32_t display_cid, erase_cid; | ||
| 18376 | byte flags, arg; | ||
| 18377 |
2/4✓ Branch 0 taken 894 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 894 times.
✗ Branch 3 not taken.
|
894 | if (!p_getc(&type, f)) |
| 18378 | { | ||
| 18379 | ✗ | return qe_invalid; | |
| 18380 | } | ||
| 18381 |
2/4✓ Branch 0 taken 894 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 894 times.
✗ Branch 3 not taken.
|
894 | if (!p_igetl(&display_cid, f)) |
| 18382 | { | ||
| 18383 | ✗ | return qe_invalid; | |
| 18384 | } | ||
| 18385 |
2/4✓ Branch 0 taken 894 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 894 times.
✗ Branch 3 not taken.
|
894 | if (!p_igetl(&erase_cid, f)) |
| 18386 | { | ||
| 18387 | ✗ | return qe_invalid; | |
| 18388 | } | ||
| 18389 |
2/4✓ Branch 0 taken 894 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 894 times.
✗ Branch 3 not taken.
|
894 | if (!p_getc(&flags, f)) |
| 18390 | { | ||
| 18391 | ✗ | return qe_invalid; | |
| 18392 | } | ||
| 18393 |
2/4✓ Branch 0 taken 894 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 894 times.
✗ Branch 3 not taken.
|
894 | if (!p_getc(&arg, f)) |
| 18394 | { | ||
| 18395 | ✗ | return qe_invalid; | |
| 18396 | } | ||
| 18397 | 894 | int32_t num_combos_in_cauto = 0; | |
| 18398 |
2/4✓ Branch 0 taken 894 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 894 times.
✗ Branch 3 not taken.
|
894 | if (!p_igetl(&num_combos_in_cauto, f)) |
| 18399 | { | ||
| 18400 | ✗ | return qe_invalid; | |
| 18401 | } | ||
| 18402 |
1/2✓ Branch 0 taken 894 times.
✗ Branch 1 not taken.
|
894 | if (num_combos_in_cauto < 1) continue; //nothing to read |
| 18403 | |||
| 18404 |
1/2✓ Branch 0 taken 894 times.
✗ Branch 1 not taken.
|
894 | temp_cauto.clear(); |
| 18405 | |||
| 18406 |
1/2✓ Branch 0 taken 894 times.
✗ Branch 1 not taken.
|
894 | temp_cauto.setType(type); |
| 18407 |
1/2✓ Branch 0 taken 894 times.
✗ Branch 1 not taken.
|
894 | temp_cauto.setDisplay(display_cid); |
| 18408 |
1/2✓ Branch 0 taken 894 times.
✗ Branch 1 not taken.
|
894 | temp_cauto.setEraseCombo(erase_cid); |
| 18409 |
1/2✓ Branch 0 taken 894 times.
✗ Branch 1 not taken.
|
894 | temp_cauto.setFlags(flags); |
| 18410 |
1/2✓ Branch 0 taken 894 times.
✗ Branch 1 not taken.
|
894 | temp_cauto.setArg(arg); |
| 18411 | |||
| 18412 | int32_t ca_cid; byte ca_ctype; int16_t ca_offset; int16_t ca_engrave_offset; | ||
| 18413 |
2/2✓ Branch 0 taken 894 times.
✓ Branch 1 taken 11304 times.
|
12198 | for (auto q = 0; q < num_combos_in_cauto; ++q) |
| 18414 | { | ||
| 18415 |
2/4✓ Branch 0 taken 11304 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 11304 times.
✗ Branch 3 not taken.
|
11304 | if (!p_getc(&ca_ctype, f)) |
| 18416 | { | ||
| 18417 | ✗ | return qe_invalid; | |
| 18418 | } | ||
| 18419 |
2/4✓ Branch 0 taken 11304 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 11304 times.
✗ Branch 3 not taken.
|
11304 | if (!p_igetl(&ca_cid, f)) |
| 18420 | { | ||
| 18421 | ✗ | return qe_invalid; | |
| 18422 | } | ||
| 18423 |
1/2✓ Branch 0 taken 11304 times.
✗ Branch 1 not taken.
|
11304 | temp_cauto.addEntry(ca_cid, ca_ctype, q, -1); |
| 18424 | 11304 | } | |
| 18425 | |||
| 18426 |
1/2✓ Branch 0 taken 894 times.
✗ Branch 1 not taken.
|
894 | combo_autos[ca] = temp_cauto; |
| 18427 | 894 | } | |
| 18428 | |||
| 18429 | 612 | return 0; | |
| 18430 | 612 | } | |
| 18431 | |||
| 18432 | 695 | int32_t readcolordata(PACKFILE *f, miscQdata *Misc, word version, word build, word start_cset, word max_csets) | |
| 18433 | { | ||
| 18434 |
2/2✓ Branch 0 taken 671 times.
✓ Branch 1 taken 24 times.
|
695 | bool should_skip = legacy_skip_flags && get_bit(legacy_skip_flags, skip_colors); |
| 18435 | |||
| 18436 | //these are here to bypass compiler warnings about unused arguments | ||
| 18437 | //THE *48 REFERS TO EACH CSET BEING 16 COLORS with 3 VALUES OF RGB (3*16 is 48) | ||
| 18438 | //Capitalized cause it'll save you a headache. -Deedee | ||
| 18439 | 695 | start_cset=start_cset; | |
| 18440 | 695 | max_csets=max_csets; | |
| 18441 | 695 | word s_version=0; | |
| 18442 | |||
| 18443 | miscQdata temp_misc; | ||
| 18444 | 695 | memcpy(&temp_misc, Misc, sizeof(temp_misc)); | |
| 18445 | |||
| 18446 | byte temp_colordata[48]; | ||
| 18447 | char temp_palname[PALNAMESIZE+1]; | ||
| 18448 | |||
| 18449 | int32_t dummy; | ||
| 18450 | word palcycles; | ||
| 18451 | |||
| 18452 |
2/2✓ Branch 0 taken 24 times.
✓ Branch 1 taken 671 times.
|
695 | if(version > 0x192) |
| 18453 | { | ||
| 18454 | //section version info | ||
| 18455 |
1/2✓ Branch 0 taken 671 times.
✗ Branch 1 not taken.
|
671 | if(!p_igetw(&s_version,f)) |
| 18456 | { | ||
| 18457 | ✗ | return qe_invalid; | |
| 18458 | } | ||
| 18459 | |||
| 18460 | 671 | FFCore.quest_format[vCSets] = s_version; | |
| 18461 | |||
| 18462 | //al_trace("Color data version %d\n", s_version); | ||
| 18463 |
1/2✓ Branch 0 taken 671 times.
✗ Branch 1 not taken.
|
671 | if(!p_igetw(&dummy,f)) |
| 18464 | { | ||
| 18465 | ✗ | return qe_invalid; | |
| 18466 | } | ||
| 18467 | |||
| 18468 | //section size | ||
| 18469 |
1/2✓ Branch 0 taken 671 times.
✗ Branch 1 not taken.
|
671 | if(!p_igetl(&dummy,f)) |
| 18470 | { | ||
| 18471 | ✗ | return qe_invalid; | |
| 18472 | } | ||
| 18473 | 671 | } | |
| 18474 |
2/2✓ Branch 0 taken 272 times.
✓ Branch 1 taken 423 times.
|
695 | if (s_version < 5) |
| 18475 | { | ||
| 18476 |
4/4✓ Branch 0 taken 18 times.
✓ Branch 1 taken 254 times.
✓ Branch 2 taken 248 times.
✓ Branch 3 taken 6 times.
|
272 | bool RealOldVerion = ((version < 0x192)||((version == 0x192)&&(build<73))); |
| 18477 | |||
| 18478 | //finally... section data | ||
| 18479 | 272 | int32_t q = 0; | |
| 18480 | 272 | int32_t p = -15; | |
| 18481 |
2/2✓ Branch 0 taken 65280 times.
✓ Branch 1 taken 272 times.
|
65552 | for(int32_t i=0; i<oldpdTOTAL; ++i) |
| 18482 | { | ||
| 18483 | 65280 | memset(temp_colordata, 0, 48); | |
| 18484 | |||
| 18485 |
1/2✓ Branch 0 taken 65280 times.
✗ Branch 1 not taken.
|
65280 | if(!pfread(temp_colordata,48,f)) |
| 18486 | { | ||
| 18487 | ✗ | return qe_invalid; | |
| 18488 | } | ||
| 18489 | |||
| 18490 |
2/2✓ Branch 0 taken 240 times.
✓ Branch 1 taken 65040 times.
|
65280 | if (should_skip) |
| 18491 | 240 | continue; | |
| 18492 | |||
| 18493 | 65040 | memcpy(&colordata[q*48], temp_colordata, 48); | |
| 18494 | |||
| 18495 | 65040 | ++q; | |
| 18496 |
8/8✓ Branch 0 taken 60704 times.
✓ Branch 1 taken 4336 times.
✓ Branch 2 taken 4607 times.
✓ Branch 3 taken 56097 times.
✓ Branch 4 taken 542 times.
✓ Branch 5 taken 4065 times.
✓ Branch 6 taken 36 times.
✓ Branch 7 taken 506 times.
|
65040 | if (p > 0 && (p%13)==12 && (i < oldpoSPRITE || !RealOldVerion)) //It's > 0 instead of >= 0 because it should append |
| 18497 | { | ||
| 18498 |
1/2✓ Branch 0 taken 4571 times.
✗ Branch 1 not taken.
|
4571 | if (s_version < 5) //Bumping up the size of level palettes |
| 18499 | { | ||
| 18500 | 4571 | memcpy(&colordata[(q)*48], &colordata[1*48], 48); | |
| 18501 | 4571 | memcpy(&colordata[(q+1)*48], &colordata[5*48], 48); | |
| 18502 | 4571 | memcpy(&colordata[(q+2)*48], &colordata[7*48], 48); | |
| 18503 | 4571 | memcpy(&colordata[(q+3)*48], &colordata[8*48], 48); | |
| 18504 | 4571 | q+=4; | |
| 18505 | 4571 | } | |
| 18506 | else | ||
| 18507 | { | ||
| 18508 | ✗ | for(int m = 0; m < 4; ++m) | |
| 18509 | { | ||
| 18510 | ✗ | memset(temp_colordata, 0, 48); | |
| 18511 | ✗ | if(!pfread(temp_colordata,48,f)) | |
| 18512 | { | ||
| 18513 | ✗ | return qe_invalid; | |
| 18514 | } | ||
| 18515 | ✗ | memcpy(&colordata[q*48], temp_colordata, 48); | |
| 18516 | ✗ | ++q; | |
| 18517 | ✗ | } | |
| 18518 | } | ||
| 18519 | 4571 | } | |
| 18520 | 65040 | ++p; | |
| 18521 | 65040 | } | |
| 18522 | |||
| 18523 |
2/2✓ Branch 0 taken 18 times.
✓ Branch 1 taken 254 times.
|
272 | if(RealOldVerion) |
| 18524 | { | ||
| 18525 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 18 times.
|
18 | if (!should_skip) |
| 18526 | { | ||
| 18527 | 18 | memcpy(colordata+(poSPRITE255*48), colordata+((q-30)*48), 30*16*3); | |
| 18528 | 18 | memset(colordata+((q-30)*48), 0, ((poSPRITE255-(q-30))*48)); | |
| 18529 | 18 | memcpy(colordata+((poSPRITE255+11)*48), colordata+((poSPRITE255+10)*48), 48); | |
| 18530 | 18 | memcpy(colordata+((poSPRITE255+10)*48), colordata+((poSPRITE255+9)*48), 48); | |
| 18531 | 18 | memcpy(colordata+((poSPRITE255+9)*48), colordata+((poSPRITE255+8)*48), 48); | |
| 18532 | 18 | memset(colordata+((poSPRITE255+8)*48), 0, 48); | |
| 18533 | 18 | } | |
| 18534 | 18 | } | |
| 18535 | else | ||
| 18536 | { | ||
| 18537 | 254 | memset(temp_colordata, 0, 48); | |
| 18538 | |||
| 18539 |
2/2✓ Branch 0 taken 795782 times.
✓ Branch 1 taken 254 times.
|
796036 | for(int32_t i=0; i<newpdTOTAL-oldpdTOTAL; ++i) |
| 18540 | { | ||
| 18541 |
1/2✓ Branch 0 taken 795782 times.
✗ Branch 1 not taken.
|
795782 | if(!pfread(temp_colordata,48,f)) |
| 18542 | { | ||
| 18543 | ✗ | return qe_invalid; | |
| 18544 | } | ||
| 18545 | |||
| 18546 |
2/2✓ Branch 0 taken 3133 times.
✓ Branch 1 taken 792649 times.
|
795782 | if (should_skip) |
| 18547 | 3133 | continue; | |
| 18548 | |||
| 18549 | 792649 | memcpy(&colordata[q*48], temp_colordata, 48); | |
| 18550 | |||
| 18551 | 792649 | ++q; | |
| 18552 |
7/8✓ Branch 0 taken 792649 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 60973 times.
✓ Branch 3 taken 731676 times.
✓ Branch 4 taken 506 times.
✓ Branch 5 taken 60467 times.
✓ Branch 6 taken 378 times.
✓ Branch 7 taken 128 times.
|
792649 | if (p > 0 && (p%13)==12 && (i < (newpoSPRITE-oldpdTOTAL) || (s_version >= 4))) //It's > 0 instead of >= 0 because it should append |
| 18553 | { | ||
| 18554 |
1/2✓ Branch 0 taken 60845 times.
✗ Branch 1 not taken.
|
60845 | if (s_version < 5) //Bumping up the size of level palettes |
| 18555 | { | ||
| 18556 | 60845 | memcpy(&colordata[(q)*48], &colordata[1*48], 48); | |
| 18557 | 60845 | memcpy(&colordata[(q+1)*48], &colordata[5*48], 48); | |
| 18558 | 60845 | memcpy(&colordata[(q+2)*48], &colordata[7*48], 48); | |
| 18559 | 60845 | memcpy(&colordata[(q+3)*48], &colordata[8*48], 48); | |
| 18560 | 60845 | q+=4; | |
| 18561 | 60845 | } | |
| 18562 | else | ||
| 18563 | { | ||
| 18564 | ✗ | for(int m = 0; m < 4; ++m) | |
| 18565 | { | ||
| 18566 | ✗ | memset(temp_colordata, 0, 48); | |
| 18567 | ✗ | if(!pfread(temp_colordata,48,f)) | |
| 18568 | { | ||
| 18569 | ✗ | return qe_invalid; | |
| 18570 | } | ||
| 18571 | ✗ | memcpy(&colordata[q*48], temp_colordata, 48); | |
| 18572 | ✗ | ++q; | |
| 18573 | ✗ | } | |
| 18574 | } | ||
| 18575 | 60845 | } | |
| 18576 | 792649 | ++p; | |
| 18577 | 792649 | } | |
| 18578 | |||
| 18579 |
2/2✓ Branch 0 taken 65 times.
✓ Branch 1 taken 189 times.
|
254 | if(s_version < 4) |
| 18580 | { | ||
| 18581 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 64 times.
|
65 | if (!should_skip) |
| 18582 | { | ||
| 18583 | 64 | memcpy(colordata+(poSPRITE255*48), colordata+((q-30)*48), 30*16*3); | |
| 18584 | 64 | memset(colordata+((q-30)*48), 0, ((poSPRITE255-(q-30))*48)); | |
| 18585 | 64 | } | |
| 18586 | 65 | } | |
| 18587 | else | ||
| 18588 | { | ||
| 18589 |
2/2✓ Branch 0 taken 628992 times.
✓ Branch 1 taken 189 times.
|
629181 | for(int32_t i=0; i<newerpdTOTAL-newpdTOTAL; ++i) |
| 18590 | { | ||
| 18591 |
1/2✓ Branch 0 taken 628992 times.
✗ Branch 1 not taken.
|
628992 | if(!pfread(temp_colordata,48,f)) |
| 18592 | { | ||
| 18593 | ✗ | return qe_invalid; | |
| 18594 | } | ||
| 18595 | |||
| 18596 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 628992 times.
|
628992 | if (should_skip) |
| 18597 | ✗ | continue; | |
| 18598 | |||
| 18599 | 628992 | memcpy(&colordata[q*48], temp_colordata, 48); | |
| 18600 | 628992 | ++q; | |
| 18601 |
5/6✓ Branch 0 taken 628992 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 48384 times.
✓ Branch 3 taken 580608 times.
✓ Branch 4 taken 378 times.
✓ Branch 5 taken 48006 times.
|
628992 | if (p > 0 && (p%13)==12 && i < newerpoSPRITE-newpdTOTAL) //It's > 0 instead of >= 0 because it should append |
| 18602 | { | ||
| 18603 |
1/2✓ Branch 0 taken 48006 times.
✗ Branch 1 not taken.
|
48006 | if (s_version < 5) //Bumping up the size of level palettes |
| 18604 | { | ||
| 18605 | 48006 | memcpy(&colordata[(q)*48], &colordata[1*48], 48); | |
| 18606 | 48006 | memcpy(&colordata[(q+1)*48], &colordata[5*48], 48); | |
| 18607 | 48006 | memcpy(&colordata[(q+2)*48], &colordata[7*48], 48); | |
| 18608 | 48006 | memcpy(&colordata[(q+3)*48], &colordata[8*48], 48); | |
| 18609 | 48006 | q+=4; | |
| 18610 | 48006 | } | |
| 18611 | else | ||
| 18612 | { | ||
| 18613 | ✗ | for(int m = 0; m < 4; ++m) | |
| 18614 | { | ||
| 18615 | ✗ | memset(temp_colordata, 0, 48); | |
| 18616 | ✗ | if(!pfread(temp_colordata,48,f)) | |
| 18617 | { | ||
| 18618 | ✗ | return qe_invalid; | |
| 18619 | } | ||
| 18620 | ✗ | memcpy(&colordata[q*48], temp_colordata, 48); | |
| 18621 | ✗ | ++q; | |
| 18622 | ✗ | } | |
| 18623 | } | ||
| 18624 | 48006 | } | |
| 18625 | 628992 | ++p; | |
| 18626 | 628992 | } | |
| 18627 | |||
| 18628 | //By this point, q should be about equal to pdTOTAL255. If it isn't, I've fucked up. -Deedee | ||
| 18629 | } | ||
| 18630 | } | ||
| 18631 | 272 | } | |
| 18632 | else | ||
| 18633 | { | ||
| 18634 |
2/2✓ Branch 0 taken 3700827 times.
✓ Branch 1 taken 423 times.
|
3701250 | for(int32_t i=0; i<pdTOTAL255; ++i) |
| 18635 | { | ||
| 18636 | 3700827 | memset(temp_colordata, 0, 48); | |
| 18637 | |||
| 18638 |
1/2✓ Branch 0 taken 3700827 times.
✗ Branch 1 not taken.
|
3700827 | if(!pfread(temp_colordata,48,f)) |
| 18639 | { | ||
| 18640 | ✗ | return qe_invalid; | |
| 18641 | } | ||
| 18642 | |||
| 18643 | 3700827 | memcpy(&colordata[i*48], temp_colordata, 48); | |
| 18644 | 3700827 | } | |
| 18645 | } | ||
| 18646 | |||
| 18647 |
5/6✓ Branch 0 taken 677 times.
✓ Branch 1 taken 18 times.
✓ Branch 2 taken 6 times.
✓ Branch 3 taken 671 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 6 times.
|
695 | if((version < 0x192)||((version == 0x192)&&(build<76))) |
| 18648 | { | ||
| 18649 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 18 times.
|
18 | if (!should_skip) |
| 18650 | 18 | init_palnames(); | |
| 18651 | 18 | } | |
| 18652 | else | ||
| 18653 | { | ||
| 18654 | 677 | int32_t palnamestoread = 0; | |
| 18655 | |||
| 18656 |
2/2✓ Branch 0 taken 65 times.
✓ Branch 1 taken 612 times.
|
677 | if(s_version < 3) |
| 18657 | 65 | palnamestoread = OLDMAXLEVELS; | |
| 18658 | else | ||
| 18659 | 612 | palnamestoread = 512; | |
| 18660 | |||
| 18661 |
2/2✓ Branch 0 taken 329984 times.
✓ Branch 1 taken 677 times.
|
330661 | for(int32_t i=0; i<palnamestoread; ++i) |
| 18662 | { | ||
| 18663 |
1/2✓ Branch 0 taken 329984 times.
✗ Branch 1 not taken.
|
329984 | if(!p_getstr(temp_palname,PALNAMESIZE,f)) |
| 18664 | { | ||
| 18665 | ✗ | return qe_invalid; | |
| 18666 | } | ||
| 18667 | |||
| 18668 |
2/2✓ Branch 0 taken 256 times.
✓ Branch 1 taken 329728 times.
|
329984 | if (!should_skip) |
| 18669 | 329728 | memcpy(palnames[i], temp_palname, PALNAMESIZE); | |
| 18670 | 329984 | } | |
| 18671 | |||
| 18672 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 676 times.
|
677 | if (should_skip) |
| 18673 | 1 | return 0; | |
| 18674 | |||
| 18675 |
2/2✓ Branch 0 taken 16384 times.
✓ Branch 1 taken 676 times.
|
17060 | for(int32_t i=palnamestoread; i<MAXLEVELS; i++) |
| 18676 | { | ||
| 18677 | 16384 | memset(palnames[i], 0, PALNAMESIZE); | |
| 18678 | 16384 | } | |
| 18679 | } | ||
| 18680 | |||
| 18681 |
2/2✓ Branch 0 taken 23 times.
✓ Branch 1 taken 671 times.
|
694 | if(version > 0x192) |
| 18682 | { | ||
| 18683 |
2/2✓ Branch 0 taken 171776 times.
✓ Branch 1 taken 671 times.
|
172447 | for(int32_t i=0; i<256; i++) |
| 18684 | { | ||
| 18685 |
2/2✓ Branch 0 taken 515328 times.
✓ Branch 1 taken 171776 times.
|
687104 | for(int32_t j=0; j<3; j++) |
| 18686 | { | ||
| 18687 | 515328 | temp_misc.cycles[i][j].first=0; | |
| 18688 | 515328 | temp_misc.cycles[i][j].count=0; | |
| 18689 | 515328 | temp_misc.cycles[i][j].speed=0; | |
| 18690 | 515328 | } | |
| 18691 | 171776 | } | |
| 18692 | |||
| 18693 |
1/2✓ Branch 0 taken 671 times.
✗ Branch 1 not taken.
|
671 | if(!p_igetw(&palcycles,f)) |
| 18694 | { | ||
| 18695 | ✗ | return qe_invalid; | |
| 18696 | } | ||
| 18697 | |||
| 18698 |
2/4✓ Branch 0 taken 671 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 671 times.
|
671 | if (!(palcycles >= 0 && palcycles <= NUM_PAL_CYCLES)) |
| 18699 | { | ||
| 18700 | ✗ | return qe_invalid; | |
| 18701 | } | ||
| 18702 | |||
| 18703 |
2/2✓ Branch 0 taken 15342 times.
✓ Branch 1 taken 671 times.
|
16013 | for(int32_t i=0; i<palcycles; i++) |
| 18704 | { | ||
| 18705 |
2/2✓ Branch 0 taken 46026 times.
✓ Branch 1 taken 15342 times.
|
61368 | for(int32_t j=0; j<3; j++) |
| 18706 | { | ||
| 18707 |
1/2✓ Branch 0 taken 46026 times.
✗ Branch 1 not taken.
|
46026 | if(!p_getc(&temp_misc.cycles[i][j].first,f)) |
| 18708 | { | ||
| 18709 | ✗ | return qe_invalid; | |
| 18710 | } | ||
| 18711 | 46026 | } | |
| 18712 | |||
| 18713 |
2/2✓ Branch 0 taken 46026 times.
✓ Branch 1 taken 15342 times.
|
61368 | for(int32_t j=0; j<3; j++) |
| 18714 | { | ||
| 18715 |
1/2✓ Branch 0 taken 46026 times.
✗ Branch 1 not taken.
|
46026 | if(!p_getc(&temp_misc.cycles[i][j].count,f)) |
| 18716 | { | ||
| 18717 | ✗ | return qe_invalid; | |
| 18718 | } | ||
| 18719 | 46026 | } | |
| 18720 | |||
| 18721 |
2/2✓ Branch 0 taken 46026 times.
✓ Branch 1 taken 15342 times.
|
61368 | for(int32_t j=0; j<3; j++) |
| 18722 | { | ||
| 18723 |
1/2✓ Branch 0 taken 46026 times.
✗ Branch 1 not taken.
|
46026 | if(!p_getc(&temp_misc.cycles[i][j].speed,f)) |
| 18724 | { | ||
| 18725 | ✗ | return qe_invalid; | |
| 18726 | } | ||
| 18727 | 46026 | } | |
| 18728 | 15342 | } | |
| 18729 | |||
| 18730 | 671 | memcpy(Misc, &temp_misc, sizeof(temp_misc)); | |
| 18731 | 671 | } | |
| 18732 | |||
| 18733 | 694 | return 0; | |
| 18734 | 695 | } | |
| 18735 | |||
| 18736 | 695 | int32_t readtiles(PACKFILE *f, tiledata *buf, zquestheader *Header, word version, word build, word start_tile, int32_t max_tiles, bool from_init) | |
| 18737 | { | ||
| 18738 |
2/2✓ Branch 0 taken 671 times.
✓ Branch 1 taken 24 times.
|
695 | bool should_skip = legacy_skip_flags && get_bit(legacy_skip_flags, skip_tiles); |
| 18739 | |||
| 18740 | 695 | int32_t tiles_used=0; | |
| 18741 | 695 | word section_version = 0; | |
| 18742 | 695 | word section_cversion = 0; | |
| 18743 | 695 | int32_t section_size= 0; | |
| 18744 | 695 | byte *temp_tile = new byte[tilesize(tf32Bit)]; | |
| 18745 | |||
| 18746 | //Tile Expansion | ||
| 18747 | //if ( version >= 0x254 && build >= 41 ) | ||
| 18748 |
4/4✓ Branch 0 taken 272 times.
✓ Branch 1 taken 423 times.
✓ Branch 2 taken 6 times.
✓ Branch 3 taken 266 times.
|
695 | if (version < 0x254 && build < 41) |
| 18749 | { | ||
| 18750 | //al_trace("Build was < 41 when reading tiles\n"); | ||
| 18751 | 266 | max_tiles = ZC250MAXTILES; | |
| 18752 | 266 | } | |
| 18753 | |||
| 18754 | //al_trace("Max Tiles: %d\n", max_tiles); | ||
| 18755 | |||
| 18756 |
2/6✓ Branch 0 taken 695 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 695 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
695 | if(Header!=NULL&&(!Header->data_flags[ZQ_TILES]&&!from_init)) //keep for old quests |
| 18757 | { | ||
| 18758 | ✗ | if(!init_tiles(true, Header)) | |
| 18759 | { | ||
| 18760 | ✗ | al_trace("Unable to initialize tiles\n"); | |
| 18761 | ✗ | } | |
| 18762 | |||
| 18763 | ✗ | delete[] temp_tile; | |
| 18764 | ✗ | temp_tile=NULL; | |
| 18765 | ✗ | return 0; | |
| 18766 | } | ||
| 18767 | else | ||
| 18768 | { | ||
| 18769 |
2/2✓ Branch 0 taken 24 times.
✓ Branch 1 taken 671 times.
|
695 | if(version > 0x192) |
| 18770 | { | ||
| 18771 | //section version info | ||
| 18772 |
1/2✓ Branch 0 taken 671 times.
✗ Branch 1 not taken.
|
671 | if(!p_igetw(§ion_version,f)) |
| 18773 | { | ||
| 18774 | ✗ | delete[] temp_tile; | |
| 18775 | ✗ | return qe_invalid; | |
| 18776 | } | ||
| 18777 | |||
| 18778 | 671 | FFCore.quest_format[vTiles] = section_version; | |
| 18779 | |||
| 18780 |
1/2✓ Branch 0 taken 671 times.
✗ Branch 1 not taken.
|
671 | if(!p_igetw(§ion_cversion,f)) |
| 18781 | { | ||
| 18782 | ✗ | delete[] temp_tile; | |
| 18783 | ✗ | return qe_invalid; | |
| 18784 | } | ||
| 18785 | |||
| 18786 | //section size | ||
| 18787 |
1/2✓ Branch 0 taken 671 times.
✗ Branch 1 not taken.
|
671 | if(!p_igetl(§ion_size,f)) |
| 18788 | { | ||
| 18789 | ✗ | delete[] temp_tile; | |
| 18790 | ✗ | return qe_invalid; | |
| 18791 | } | ||
| 18792 | 671 | } | |
| 18793 | |||
| 18794 | //if ( build < 41 ) | ||
| 18795 | //{ | ||
| 18796 | // tiles_used = ZC250MAXTILES; | ||
| 18797 | //} | ||
| 18798 | |||
| 18799 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 695 times.
|
695 | if(version < 0x174) |
| 18800 | { | ||
| 18801 | ✗ | tiles_used=TILES_PER_PAGE*4; | |
| 18802 | ✗ | } //no expanded tile space | |
| 18803 |
2/2✓ Branch 0 taken 18 times.
✓ Branch 1 taken 677 times.
|
695 | else if(version < 0x191) |
| 18804 | { | ||
| 18805 | 18 | tiles_used=OLDMAXTILES; | |
| 18806 | 18 | } | |
| 18807 | else | ||
| 18808 | { | ||
| 18809 | //finally... section data | ||
| 18810 |
3/4✓ Branch 0 taken 423 times.
✓ Branch 1 taken 254 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 423 times.
|
677 | if ( version >= 0x254 && build >= 41 ) //read and write the size of tiles_used properly |
| 18811 | { | ||
| 18812 |
1/2✓ Branch 0 taken 423 times.
✗ Branch 1 not taken.
|
423 | if(!p_igetl(&tiles_used,f)) |
| 18813 | { | ||
| 18814 | ✗ | delete[] temp_tile; | |
| 18815 | ✗ | return qe_invalid; | |
| 18816 | } | ||
| 18817 | 423 | } | |
| 18818 | else | ||
| 18819 | { | ||
| 18820 |
1/2✓ Branch 0 taken 254 times.
✗ Branch 1 not taken.
|
254 | if(!p_igetw(&tiles_used,f)) |
| 18821 | { | ||
| 18822 | ✗ | delete[] temp_tile; | |
| 18823 | ✗ | return qe_invalid; | |
| 18824 | } | ||
| 18825 | } | ||
| 18826 | } | ||
| 18827 | |||
| 18828 |
1/2✓ Branch 0 taken 695 times.
✗ Branch 1 not taken.
|
695 | tiles_used=zc_min(tiles_used, max_tiles); |
| 18829 | |||
| 18830 | //if ( version < 0x254 || ( version >= 0x254 && build < 41 )) //don't do this, it crashes ZQuest. -Z | ||
| 18831 | //if ( version < 0x254 && build < 41 ) | ||
| 18832 |
3/6✓ Branch 0 taken 423 times.
✓ Branch 1 taken 272 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 423 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
695 | if ( version < 0x254 || (version == 0x254 && build < 41) ) |
| 18833 | //if ( build < 41 ) | ||
| 18834 | { | ||
| 18835 |
1/2✓ Branch 0 taken 272 times.
✗ Branch 1 not taken.
|
272 | tiles_used=zc_min(tiles_used, ZC250MAXTILES-start_tile); |
| 18836 | 272 | } | |
| 18837 | else //2.55 | ||
| 18838 | { | ||
| 18839 |
1/2✓ Branch 0 taken 423 times.
✗ Branch 1 not taken.
|
423 | tiles_used = zc_min(tiles_used,NEWMAXTILES-start_tile); |
| 18840 | } | ||
| 18841 | |||
| 18842 | //if ( section_version > 1 ) tiles_used = NEWMAXTILES; | ||
| 18843 | |||
| 18844 | //al_trace("tiles_used = %d\n", tiles_used); | ||
| 18845 | |||
| 18846 |
2/2✓ Branch 0 taken 28425391 times.
✓ Branch 1 taken 695 times.
|
28426086 | for(int32_t i=0; i<tiles_used; ++i) |
| 18847 | { | ||
| 18848 | 28425391 | byte format=tf4Bit; | |
| 18849 | 28425391 | memset(temp_tile, 0, tilesize(tf32Bit)); | |
| 18850 | |||
| 18851 |
3/6✓ Branch 0 taken 2985456 times.
✓ Branch 1 taken 25439935 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 2985456 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
28425391 | if((version>0x211)||((version==0x211)&&(build>4))) |
| 18852 | { | ||
| 18853 |
1/2✓ Branch 0 taken 25439935 times.
✗ Branch 1 not taken.
|
25439935 | if(!p_getc(&format,f)) |
| 18854 | { | ||
| 18855 | ✗ | delete[] temp_tile; | |
| 18856 | ✗ | return qe_invalid; | |
| 18857 | } | ||
| 18858 | 25439935 | } | |
| 18859 |
4/4✓ Branch 0 taken 18222800 times.
✓ Branch 1 taken 10202591 times.
✓ Branch 2 taken 8323020 times.
✓ Branch 3 taken 9899780 times.
|
28425391 | if(section_version > 2 && !format) |
| 18860 | { | ||
| 18861 | 9899780 | reset_tile(buf,start_tile+i,tf4Bit); | |
| 18862 | 9899780 | continue; | |
| 18863 | } | ||
| 18864 | |||
| 18865 |
2/2✓ Branch 0 taken 18012104 times.
✓ Branch 1 taken 513507 times.
|
18525611 | int size = format == tf4Bit ? 128 : tilesize(format); |
| 18866 |
1/2✓ Branch 0 taken 18525611 times.
✗ Branch 1 not taken.
|
18525611 | if(!pfread(temp_tile,size,f)) |
| 18867 | { | ||
| 18868 | ✗ | delete[] temp_tile; | |
| 18869 | ✗ | return qe_invalid; | |
| 18870 | } | ||
| 18871 | |||
| 18872 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 18525611 times.
|
18525611 | if (should_skip) |
| 18873 | ✗ | continue; | |
| 18874 | |||
| 18875 | 18525611 | buf[start_tile+i].format=format; | |
| 18876 | |||
| 18877 |
2/2✓ Branch 0 taken 18354467 times.
✓ Branch 1 taken 171144 times.
|
18525611 | if(buf[start_tile+i].data) |
| 18878 | { | ||
| 18879 | 18354467 | free(buf[start_tile+i].data); | |
| 18880 | 18354467 | buf[start_tile+i].data=NULL; | |
| 18881 | 18354467 | } | |
| 18882 | |||
| 18883 | 18525611 | buf[start_tile+i].data=(byte *)malloc(tilesize(buf[start_tile+i].format)); | |
| 18884 | |||
| 18885 |
2/2✓ Branch 0 taken 18012104 times.
✓ Branch 1 taken 513507 times.
|
18525611 | if (format == tf4Bit) |
| 18886 | { | ||
| 18887 | byte temp[256]; | ||
| 18888 | 18012104 | byte *si = temp_tile + 128; | |
| 18889 | 18012104 | byte *di = temp + 256; | |
| 18890 | |||
| 18891 |
2/2✓ Branch 0 taken 2305549312 times.
✓ Branch 1 taken 18012104 times.
|
2323561416 | for(int i=127; i>=0; --i) |
| 18892 | { | ||
| 18893 | 2305549312 | (*(--di)) = (*(--si)) >> 4; | |
| 18894 | 2305549312 | (*(--di)) = (*si) & 15; | |
| 18895 | 2305549312 | } | |
| 18896 | |||
| 18897 | 18012104 | memcpy(buf[start_tile+i].data,temp,256); | |
| 18898 | 18012104 | } | |
| 18899 | else | ||
| 18900 | { | ||
| 18901 | 513507 | memcpy(buf[start_tile+i].data,temp_tile,tilesize(buf[start_tile+i].format)); | |
| 18902 | } | ||
| 18903 | 18525611 | } | |
| 18904 | } | ||
| 18905 | |||
| 18906 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 695 times.
|
695 | if (should_skip) |
| 18907 | ✗ | return 0; | |
| 18908 | |||
| 18909 |
2/2✓ Branch 0 taken 423 times.
✓ Branch 1 taken 272 times.
|
695 | if ( section_version < 2 ) //write blank tile data --check s_version with this again instead? |
| 18910 | { | ||
| 18911 | //al_trace("Writing blank tile data to new tiles for build < 41\n"); | ||
| 18912 |
2/2✓ Branch 0 taken 40522560 times.
✓ Branch 1 taken 272 times.
|
40522832 | for ( int32_t q = ZC250MAXTILES; q < NEWMAXTILES; ++q ) |
| 18913 | { | ||
| 18914 | |||
| 18915 | //memcpy(buf[q].data,temp_tile,tilesize(buf[q].format)); | ||
| 18916 | 40522560 | reset_tile(buf,q,tf4Bit); | |
| 18917 | |||
| 18918 | |||
| 18919 | /* | ||
| 18920 | |||
| 18921 | byte tempbyte; | ||
| 18922 | for(int32_t i=0; i<tilesize(tf4Bit); i++) | ||
| 18923 | { | ||
| 18924 | tempbyte=buf[ZC250MAXTILES-1].data[i]; | ||
| 18925 | buf[q].data[i] = tempbyte; | ||
| 18926 | } | ||
| 18927 | //int32_t temp = tempbyte=buf[130].data[i]; | ||
| 18928 | //buf[q].data = buf[ZC250MAXTILES-1].data; | ||
| 18929 | */ | ||
| 18930 | //reset_tile(buf,q,tf4Bit); | ||
| 18931 | 40522560 | } | |
| 18932 | |||
| 18933 | 272 | } | |
| 18934 | |||
| 18935 |
4/6✓ Branch 0 taken 423 times.
✓ Branch 1 taken 272 times.
✓ Branch 2 taken 423 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 423 times.
|
695 | if ( version < 0x254 || ( version >= 0x254 && build < 41 )) |
| 18936 | { | ||
| 18937 |
2/2✓ Branch 0 taken 9086445 times.
✓ Branch 1 taken 272 times.
|
9086717 | for(int32_t i=start_tile+tiles_used; i<max_tiles; ++i) |
| 18938 | { | ||
| 18939 | //al_trace("Resetting tiles for ZC250MAXTILES, iteration: %d\n", i); | ||
| 18940 | 9086445 | reset_tile(buf,i,tf4Bit); | |
| 18941 | 9086445 | } | |
| 18942 | 272 | } | |
| 18943 | else | ||
| 18944 | { | ||
| 18945 |
2/2✓ Branch 0 taken 71936984 times.
✓ Branch 1 taken 423 times.
|
71937407 | for(int32_t i=start_tile+tiles_used; i<max_tiles; ++i) |
| 18946 | { | ||
| 18947 | //al_trace("Resetting tiles for build 41+\n"); | ||
| 18948 | 71936984 | reset_tile(buf,i,tf4Bit); | |
| 18949 | 71936984 | } | |
| 18950 | } | ||
| 18951 | |||
| 18952 |
5/6✓ Branch 0 taken 677 times.
✓ Branch 1 taken 18 times.
✓ Branch 2 taken 6 times.
✓ Branch 3 taken 671 times.
✓ Branch 4 taken 6 times.
✗ Branch 5 not taken.
|
695 | if((version < 0x192)|| ((version == 0x192)&&(build<186))) |
| 18953 | { | ||
| 18954 |
2/2✓ Branch 0 taken 18 times.
✓ Branch 1 taken 6 times.
|
24 | if(get_qr(qr_BSZELDA)) // |
| 18955 | { | ||
| 18956 | byte tempbyte; | ||
| 18957 | 6 | int32_t floattile=wpnsbuf[iwSwim].tile; | |
| 18958 | |||
| 18959 |
2/2✓ Branch 0 taken 1536 times.
✓ Branch 1 taken 6 times.
|
1542 | for(int32_t i=0; i<tilesize(tf4Bit); i++) //BSZelda tiles are out of order //does this include swim tiles? |
| 18960 | { | ||
| 18961 | 1536 | tempbyte=buf[23].data[i]; | |
| 18962 | 1536 | buf[23].data[i]=buf[24].data[i]; | |
| 18963 | 1536 | buf[24].data[i]=buf[25].data[i]; | |
| 18964 | 1536 | buf[25].data[i]=buf[26].data[i]; | |
| 18965 | 1536 | buf[26].data[i]=tempbyte; | |
| 18966 | 1536 | } | |
| 18967 | //swim tiles are out of order, too, but nobody cared? -Z | ||
| 18968 |
2/2✓ Branch 0 taken 1536 times.
✓ Branch 1 taken 6 times.
|
1542 | for(int32_t i=0; i<tilesize(tf4Bit); i++) |
| 18969 | { | ||
| 18970 | 1536 | tempbyte=buf[floattile+11].data[i]; | |
| 18971 | 1536 | buf[floattile+11].data[i]=buf[floattile+12].data[i]; | |
| 18972 | 1536 | buf[floattile+12].data[i]=tempbyte; | |
| 18973 | 1536 | } | |
| 18974 | 6 | } | |
| 18975 | 24 | } | |
| 18976 | |||
| 18977 |
3/6✓ Branch 0 taken 612 times.
✓ Branch 1 taken 83 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 612 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
695 | if((version < 0x211)||((version == 0x211)&&(build<7))) //Goriya tiles are out of order |
| 18978 | { | ||
| 18979 |
2/2✓ Branch 0 taken 61 times.
✓ Branch 1 taken 22 times.
|
83 | if(!get_qr(qr_NEWENEMYTILES)) |
| 18980 | { | ||
| 18981 | byte tempbyte; | ||
| 18982 | |||
| 18983 |
2/2✓ Branch 0 taken 5632 times.
✓ Branch 1 taken 22 times.
|
5654 | for(int32_t i=0; i<tilesize(tf4Bit); i++) |
| 18984 | { | ||
| 18985 | 5632 | tempbyte=buf[130].data[i]; | |
| 18986 | 5632 | buf[130].data[i]=buf[132].data[i]; | |
| 18987 | 5632 | buf[132].data[i]=tempbyte; | |
| 18988 | |||
| 18989 | 5632 | tempbyte=buf[131].data[i]; | |
| 18990 | 5632 | buf[131].data[i]=buf[133].data[i]; | |
| 18991 | 5632 | buf[133].data[i]=tempbyte; | |
| 18992 | 5632 | } | |
| 18993 | 22 | } | |
| 18994 | 83 | } | |
| 18995 | |||
| 18996 | 695 | al_trace("Registering blank tiles\n"); | |
| 18997 | 695 | register_blank_tiles(); | |
| 18998 | |||
| 18999 | //memset(temp_tile, 0, tilesize(tf32Bit)); | ||
| 19000 |
1/2✓ Branch 0 taken 695 times.
✗ Branch 1 not taken.
|
695 | delete[] temp_tile; |
| 19001 | 695 | temp_tile=NULL; | |
| 19002 | 695 | return 0; | |
| 19003 | 695 | } | |
| 19004 | |||
| 19005 | 694 | int32_t readtunes(PACKFILE *f, zquestheader *Header, zctune *tunes /*zcmidi_ *midis*/) | |
| 19006 | { | ||
| 19007 |
2/2✓ Branch 0 taken 671 times.
✓ Branch 1 taken 23 times.
|
694 | bool should_skip = legacy_skip_flags && get_bit(legacy_skip_flags, skip_midis); |
| 19008 | |||
| 19009 | static byte fake_midi_flags[32]; | ||
| 19010 | |||
| 19011 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 694 times.
|
694 | byte *mf=should_skip ? fake_midi_flags : midi_flags; |
| 19012 | int32_t dummy; | ||
| 19013 | word dummy2; | ||
| 19014 | // zcmidi_ temp_midi; | ||
| 19015 | int32_t tunes_to_read; | ||
| 19016 | 694 | int32_t tune_count=0; | |
| 19017 | 694 | word section_version=0; | |
| 19018 | 694 | zctune temp; | |
| 19019 | |||
| 19020 |
2/2✓ Branch 0 taken 23 times.
✓ Branch 1 taken 671 times.
|
694 | if(Header->zelda_version < 0x193) |
| 19021 | { | ||
| 19022 | // mf=Header->data_flags+ZQ_MIDIS2; | ||
| 19023 |
5/6✓ Branch 0 taken 5 times.
✓ Branch 1 taken 18 times.
✓ Branch 2 taken 5 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 4 times.
✓ Branch 5 taken 1 times.
|
23 | if((Header->zelda_version < 0x192)||((Header->zelda_version == 0x192)&&(Header->build<178))) |
| 19024 | { | ||
| 19025 | 22 | tunes_to_read=MAXCUSTOMMIDIS192b177; | |
| 19026 | 22 | } | |
| 19027 | else | ||
| 19028 | { | ||
| 19029 | 1 | tunes_to_read=MAXCUSTOMTUNES; | |
| 19030 | } | ||
| 19031 | 23 | } | |
| 19032 | else | ||
| 19033 | { | ||
| 19034 | //section version info | ||
| 19035 |
1/2✓ Branch 0 taken 671 times.
✗ Branch 1 not taken.
|
671 | if(!p_igetw(§ion_version,f)) |
| 19036 | { | ||
| 19037 | ✗ | return qe_invalid; | |
| 19038 | } | ||
| 19039 | |||
| 19040 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 671 times.
|
671 | if (!should_skip) |
| 19041 | 671 | FFCore.quest_format[vMIDIs] = section_version; | |
| 19042 | |||
| 19043 | //al_trace("Tunes version %d\n", section_version); | ||
| 19044 |
1/2✓ Branch 0 taken 671 times.
✗ Branch 1 not taken.
|
671 | if(!p_igetw(&dummy2,f)) |
| 19045 | { | ||
| 19046 | ✗ | return qe_invalid; | |
| 19047 | } | ||
| 19048 | |||
| 19049 | //section size | ||
| 19050 |
1/2✓ Branch 0 taken 671 times.
✗ Branch 1 not taken.
|
671 | if(!p_igetl(&dummy,f)) |
| 19051 | { | ||
| 19052 | ✗ | return qe_invalid; | |
| 19053 | } | ||
| 19054 | |||
| 19055 | //finally... section data | ||
| 19056 |
1/2✓ Branch 0 taken 671 times.
✗ Branch 1 not taken.
|
671 | if(!pfread(midi_flags,sizeof(midi_flags),f)) |
| 19057 | { | ||
| 19058 | ✗ | return qe_invalid; | |
| 19059 | } | ||
| 19060 | |||
| 19061 | 671 | tunes_to_read=MAXCUSTOMTUNES; | |
| 19062 | } | ||
| 19063 | |||
| 19064 |
2/2✓ Branch 0 taken 174888 times.
✓ Branch 1 taken 694 times.
|
175582 | for(int32_t i=0; i<MAXCUSTOMTUNES; ++i) |
| 19065 | { | ||
| 19066 |
2/2✓ Branch 0 taken 10243 times.
✓ Branch 1 taken 164645 times.
|
174888 | if(get_bit(mf, i)) |
| 19067 | { | ||
| 19068 | 10243 | ++tune_count; | |
| 19069 | 10243 | } | |
| 19070 | 174888 | } | |
| 19071 | |||
| 19072 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 694 times.
|
694 | if (!should_skip) |
| 19073 | 694 | reset_tunes(tunes); //reset_midis(midis); | |
| 19074 | |||
| 19075 |
2/2✓ Branch 0 taken 170048 times.
✓ Branch 1 taken 694 times.
|
170742 | for(int32_t i=0; i<tunes_to_read; i++) |
| 19076 | { | ||
| 19077 | 170048 | temp.clear(); //memset(&temp_midi,0,sizeof(zcmidi_)); | |
| 19078 | |||
| 19079 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 170048 times.
|
170048 | if (!should_skip) |
| 19080 | 170048 | tunes[i].reset(); // reset_midi(midis+i); | |
| 19081 | |||
| 19082 |
2/2✓ Branch 0 taken 159805 times.
✓ Branch 1 taken 10243 times.
|
170048 | if(get_bit(mf,i)) |
| 19083 | { | ||
| 19084 |
2/2✓ Branch 0 taken 2663 times.
✓ Branch 1 taken 7580 times.
|
10243 | if(section_version < 4) |
| 19085 | { | ||
| 19086 |
1/2✓ Branch 0 taken 2663 times.
✗ Branch 1 not taken.
|
2663 | if(!p_getstr(temp.title,20,f)) |
| 19087 | { | ||
| 19088 | ✗ | return qe_invalid; | |
| 19089 | } | ||
| 19090 | 2663 | } | |
| 19091 | else | ||
| 19092 | { | ||
| 19093 |
1/2✓ Branch 0 taken 7580 times.
✗ Branch 1 not taken.
|
7580 | if(!p_getstr(temp.title,sizeof(temp.title)-1,f)) |
| 19094 | { | ||
| 19095 | ✗ | return qe_invalid; | |
| 19096 | } | ||
| 19097 | } | ||
| 19098 | |||
| 19099 |
1/2✓ Branch 0 taken 10243 times.
✗ Branch 1 not taken.
|
10243 | if(!p_igetl(&temp.start,f)) |
| 19100 | { | ||
| 19101 | ✗ | return qe_invalid; | |
| 19102 | } | ||
| 19103 | |||
| 19104 |
1/2✓ Branch 0 taken 10243 times.
✗ Branch 1 not taken.
|
10243 | if(!p_igetl(&temp.loop_start,f)) |
| 19105 | { | ||
| 19106 | ✗ | return qe_invalid; | |
| 19107 | } | ||
| 19108 | |||
| 19109 |
1/2✓ Branch 0 taken 10243 times.
✗ Branch 1 not taken.
|
10243 | if(!p_igetl(&temp.loop_end,f)) |
| 19110 | { | ||
| 19111 | ✗ | return qe_invalid; | |
| 19112 | } | ||
| 19113 | |||
| 19114 |
1/2✓ Branch 0 taken 10243 times.
✗ Branch 1 not taken.
|
10243 | if(!p_igetw(&temp.loop,f)) |
| 19115 | { | ||
| 19116 | ✗ | return qe_invalid; | |
| 19117 | } | ||
| 19118 | |||
| 19119 |
1/2✓ Branch 0 taken 10243 times.
✗ Branch 1 not taken.
|
10243 | if(!p_igetw(&temp.volume,f)) |
| 19120 | { | ||
| 19121 | ✗ | return qe_invalid; | |
| 19122 | } | ||
| 19123 | |||
| 19124 |
2/2✓ Branch 0 taken 9994 times.
✓ Branch 1 taken 249 times.
|
10243 | if(Header->zelda_version < 0x193) |
| 19125 | { | ||
| 19126 |
1/2✓ Branch 0 taken 249 times.
✗ Branch 1 not taken.
|
249 | if(!p_igetl(&dummy,f)) |
| 19127 | { | ||
| 19128 | ✗ | return qe_invalid; | |
| 19129 | } | ||
| 19130 | 249 | } | |
| 19131 | |||
| 19132 |
2/2✓ Branch 0 taken 2663 times.
✓ Branch 1 taken 7580 times.
|
10243 | if(section_version >= 3) |
| 19133 | { | ||
| 19134 |
1/2✓ Branch 0 taken 7580 times.
✗ Branch 1 not taken.
|
7580 | if(!pfread(&temp.flags,sizeof(temp.flags),f)) |
| 19135 | { | ||
| 19136 | ✗ | return qe_invalid; | |
| 19137 | } | ||
| 19138 | 7580 | } | |
| 19139 | |||
| 19140 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 10243 times.
|
10243 | if (!should_skip) |
| 19141 | 10243 | tunes[i].copyfrom(temp); // memcpy(&midis[i], &temp_midi, sizeof(zcmidi_)); | |
| 19142 | |||
| 19143 |
2/2✓ Branch 0 taken 2663 times.
✓ Branch 1 taken 7580 times.
|
10243 | if(section_version < 2) //= 1 || (Header->zelda_version < 0x211) || (Header->zelda_version == 0x211 && Header->build < 18)) |
| 19144 | { | ||
| 19145 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2663 times.
|
2663 | if (should_skip) |
| 19146 | { | ||
| 19147 | ✗ | if (read_midi(f)==NULL) | |
| 19148 | { | ||
| 19149 | ✗ | return qe_invalid; | |
| 19150 | } | ||
| 19151 | |||
| 19152 | ✗ | continue; | |
| 19153 | } | ||
| 19154 | |||
| 19155 | // old format - a midi is a midi | ||
| 19156 |
1/2✓ Branch 0 taken 2663 times.
✗ Branch 1 not taken.
|
2663 | if((tunes[i].data=read_midi(f))==NULL) |
| 19157 | { | ||
| 19158 | ✗ | return qe_invalid; | |
| 19159 | } | ||
| 19160 | |||
| 19161 | //yes you can do this. Isn't the ? operator awesome? :) | ||
| 19162 | 2663 | tunes[i].format = MFORMAT_MIDI; | |
| 19163 | 2663 | } | |
| 19164 | else | ||
| 19165 | { | ||
| 19166 | // 'midi' could be midi or nes, gb, ... music | ||
| 19167 |
1/2✓ Branch 0 taken 7580 times.
✗ Branch 1 not taken.
|
7580 | if(!pfread(&tunes[i].format,sizeof(tunes[i].format),f)) |
| 19168 | { | ||
| 19169 | ✗ | return qe_invalid; | |
| 19170 | } | ||
| 19171 | |||
| 19172 | 7580 | zctune *ptr = &tunes[i]; | |
| 19173 | |||
| 19174 |
1/2✓ Branch 0 taken 7580 times.
✗ Branch 1 not taken.
|
7580 | switch(temp.format) |
| 19175 | { | ||
| 19176 | case MFORMAT_MIDI: | ||
| 19177 |
1/2✓ Branch 0 taken 7580 times.
✗ Branch 1 not taken.
|
7580 | if((ptr->data=read_midi(f))==NULL) |
| 19178 | { | ||
| 19179 | ✗ | return qe_invalid; | |
| 19180 | } | ||
| 19181 | |||
| 19182 | 7580 | break; | |
| 19183 | |||
| 19184 | default: | ||
| 19185 | ✗ | return qe_invalid; | |
| 19186 | break; | ||
| 19187 | } | ||
| 19188 | } | ||
| 19189 | 10243 | } | |
| 19190 | 170048 | } | |
| 19191 | |||
| 19192 | 694 | return 0; | |
| 19193 | 694 | } | |
| 19194 | |||
| 19195 | 694 | int32_t readcheatcodes(PACKFILE *f, zquestheader *Header) | |
| 19196 | { | ||
| 19197 |
2/2✓ Branch 0 taken 671 times.
✓ Branch 1 taken 23 times.
|
694 | bool should_skip = legacy_skip_flags && get_bit(legacy_skip_flags, skip_cheats); |
| 19198 | |||
| 19199 | int32_t dummy; | ||
| 19200 | ZCHEATS tempzcheats; | ||
| 19201 | 694 | char temp_use_cheats=1; | |
| 19202 | 694 | memset(&tempzcheats, 0, sizeof(tempzcheats)); | |
| 19203 | 694 | word s_version = 0; | |
| 19204 | |||
| 19205 |
2/2✓ Branch 0 taken 23 times.
✓ Branch 1 taken 671 times.
|
694 | if(Header->zelda_version > 0x192) |
| 19206 | { | ||
| 19207 | //section version info | ||
| 19208 |
1/2✓ Branch 0 taken 671 times.
✗ Branch 1 not taken.
|
671 | if(!p_igetw(&s_version,f)) |
| 19209 | { | ||
| 19210 | ✗ | return qe_invalid; | |
| 19211 | } | ||
| 19212 | |||
| 19213 | 671 | FFCore.quest_format[vCheats] = s_version; | |
| 19214 | //al_trace("Cheats version %d\n", dummy); | ||
| 19215 |
1/2✓ Branch 0 taken 671 times.
✗ Branch 1 not taken.
|
671 | if(!p_igetw(&dummy,f)) |
| 19216 | { | ||
| 19217 | ✗ | return qe_invalid; | |
| 19218 | } | ||
| 19219 | |||
| 19220 | //section size | ||
| 19221 |
1/2✓ Branch 0 taken 671 times.
✗ Branch 1 not taken.
|
671 | if(!p_igetl(&dummy,f)) |
| 19222 | { | ||
| 19223 | ✗ | return qe_invalid; | |
| 19224 | } | ||
| 19225 | |||
| 19226 | //finally... section data | ||
| 19227 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 671 times.
|
671 | if(!p_getc(&temp_use_cheats,f)) |
| 19228 | { | ||
| 19229 | ✗ | return qe_invalid; | |
| 19230 | } | ||
| 19231 | 671 | } | |
| 19232 | |||
| 19233 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 694 times.
|
694 | if(Header->data_flags[ZQ_CHEATS2]) |
| 19234 | { | ||
| 19235 |
1/2✓ Branch 0 taken 694 times.
✗ Branch 1 not taken.
|
694 | if(!p_igetl(&tempzcheats.flags,f)) |
| 19236 | { | ||
| 19237 | ✗ | return qe_invalid; | |
| 19238 | } | ||
| 19239 | |||
| 19240 |
1/2✓ Branch 0 taken 694 times.
✗ Branch 1 not taken.
|
694 | if(!pfread(&tempzcheats.codes, sizeof(tempzcheats.codes),f)) |
| 19241 | { | ||
| 19242 | ✗ | return qe_invalid; | |
| 19243 | } | ||
| 19244 | 694 | } | |
| 19245 | |||
| 19246 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 694 times.
|
694 | if (should_skip) |
| 19247 | ✗ | return 0; | |
| 19248 | |||
| 19249 | 694 | memcpy(&zcheats, &tempzcheats, sizeof(tempzcheats)); | |
| 19250 | 694 | Header->data_flags[ZQ_CHEATS2]=temp_use_cheats; | |
| 19251 | |||
| 19252 | 694 | return 0; | |
| 19253 | 694 | } | |
| 19254 | |||
| 19255 | 289 | int32_t readinitdata_old(PACKFILE *f, zquestheader *Header, word s_version, word s_cversion, zinitdata& temp_zinit) | |
| 19256 | { | ||
| 19257 |
2/2✓ Branch 0 taken 23 times.
✓ Branch 1 taken 266 times.
|
289 | bool should_skip = legacy_skip_flags && get_bit(legacy_skip_flags, skip_initdata); |
| 19258 | |||
| 19259 | int32_t dummy; | ||
| 19260 | byte padding, tempbyte; | ||
| 19261 | |||
| 19262 | // Legacy item properties (now integrated into itemdata) | ||
| 19263 | byte sword_hearts[4]; | ||
| 19264 | byte beam_hearts[4]; | ||
| 19265 | 289 | byte beam_percent=0; | |
| 19266 | word beam_power[4]; | ||
| 19267 | 289 | byte hookshot_length=99; | |
| 19268 | 289 | byte hookshot_links=100; | |
| 19269 | 289 | byte longshot_length=99; | |
| 19270 | 289 | byte longshot_links=100; | |
| 19271 | 289 | byte moving_fairy_hearts=3; | |
| 19272 | 289 | byte moving_fairy_heart_percent=0; | |
| 19273 | 289 | byte stationary_fairy_hearts=3; | |
| 19274 | 289 | byte stationary_fairy_heart_percent=0; | |
| 19275 | 289 | byte moving_fairy_magic=0; | |
| 19276 | 289 | byte moving_fairy_magic_percent=0; | |
| 19277 | 289 | byte stationary_fairy_magic=0; | |
| 19278 | 289 | byte stationary_fairy_magic_percent=0; | |
| 19279 | 289 | byte blue_potion_hearts=100; | |
| 19280 | 289 | byte blue_potion_heart_percent=1; | |
| 19281 | 289 | byte red_potion_hearts=100; | |
| 19282 | 289 | byte red_potion_heart_percent=1; | |
| 19283 | 289 | byte blue_potion_magic=100; | |
| 19284 | 289 | byte blue_potion_magic_percent=1; | |
| 19285 | 289 | byte red_potion_magic=100; | |
| 19286 | 289 | byte red_potion_magic_percent=1; | |
| 19287 | |||
| 19288 | 289 | byte bomb_ratio = 4; | |
| 19289 | |||
| 19290 | 289 | subscr_mode = 0; | |
| 19291 | |||
| 19292 | /* HIGHLY UNORTHODOX UPDATING THING, by L | ||
| 19293 | * This fixes quests made before revision 277 (such as the 'Lost Isle Build'), | ||
| 19294 | * where the speed of Pols Voice changed. It also coincided with V_INITDATA | ||
| 19295 | * changing from 13 to 14. | ||
| 19296 | */ | ||
| 19297 |
2/2✓ Branch 0 taken 207 times.
✓ Branch 1 taken 82 times.
|
289 | if(s_version < 14) |
| 19298 | 82 | fixpolsvoice=true; | |
| 19299 | |||
| 19300 | /* End highly unorthodox updating thing */ | ||
| 19301 | |||
| 19302 |
4/4✓ Branch 0 taken 207 times.
✓ Branch 1 taken 82 times.
✓ Branch 2 taken 95 times.
✓ Branch 3 taken 112 times.
|
289 | if(s_version >= 15 && get_bit(deprecated_rules, 27)) // The int16_t-lived rule, qr_JUMPHEROLAYER3 |
| 19303 | 112 | temp_zinit.jump_hero_layer_threshold=0; | |
| 19304 | |||
| 19305 |
2/2✓ Branch 0 taken 82 times.
✓ Branch 1 taken 207 times.
|
289 | if(s_version >= 10) |
| 19306 | { | ||
| 19307 | char temp; | ||
| 19308 | |||
| 19309 | //new-style items | ||
| 19310 |
2/2✓ Branch 0 taken 52992 times.
✓ Branch 1 taken 207 times.
|
53199 | for(int32_t j=0; j<256; j++) |
| 19311 | { | ||
| 19312 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 52992 times.
|
52992 | if(!p_getc(&temp,f)) |
| 19313 | ✗ | return qe_invalid; | |
| 19314 | |||
| 19315 | 52992 | temp_zinit.set_item(j, temp != 0); | |
| 19316 | 52992 | } | |
| 19317 | 207 | } | |
| 19318 | |||
| 19319 |
5/6✓ Branch 0 taken 23 times.
✓ Branch 1 taken 266 times.
✓ Branch 2 taken 5 times.
✓ Branch 3 taken 18 times.
✓ Branch 4 taken 5 times.
✗ Branch 5 not taken.
|
289 | if((Header->zelda_version > 0x192)||((Header->zelda_version == 0x192)&&(Header->build>26))) |
| 19320 | { | ||
| 19321 | char temp; | ||
| 19322 | |||
| 19323 | //finally... section data | ||
| 19324 |
4/4✓ Branch 0 taken 5 times.
✓ Branch 1 taken 266 times.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 4 times.
|
276 | if((Header->zelda_version > 0x192)|| |
| 19325 | //new only | ||
| 19326 |
1/2✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
|
5 | ((Header->zelda_version == 0x192)&&(Header->build>173))) |
| 19327 | { | ||
| 19328 | //OLD-style items... sigh | ||
| 19329 |
2/2✓ Branch 0 taken 207 times.
✓ Branch 1 taken 60 times.
|
267 | if(s_version < 10) |
| 19330 | { | ||
| 19331 |
1/2✓ Branch 0 taken 60 times.
✗ Branch 1 not taken.
|
60 | if(!p_getc(&temp,f)) |
| 19332 | { | ||
| 19333 | ✗ | return qe_invalid; | |
| 19334 | } | ||
| 19335 | |||
| 19336 | 60 | temp_zinit.set_item(iRaft, temp != 0); | |
| 19337 | |||
| 19338 |
1/2✓ Branch 0 taken 60 times.
✗ Branch 1 not taken.
|
60 | if(!p_getc(&temp,f)) |
| 19339 | { | ||
| 19340 | ✗ | return qe_invalid; | |
| 19341 | } | ||
| 19342 | |||
| 19343 | 60 | temp_zinit.set_item(iLadder, temp != 0); | |
| 19344 | |||
| 19345 |
1/2✓ Branch 0 taken 60 times.
✗ Branch 1 not taken.
|
60 | if(!p_getc(&temp,f)) |
| 19346 | { | ||
| 19347 | ✗ | return qe_invalid; | |
| 19348 | } | ||
| 19349 | |||
| 19350 | 60 | temp_zinit.set_item(iBook, temp != 0); | |
| 19351 | |||
| 19352 |
1/2✓ Branch 0 taken 60 times.
✗ Branch 1 not taken.
|
60 | if(!p_getc(&temp,f)) |
| 19353 | { | ||
| 19354 | ✗ | return qe_invalid; | |
| 19355 | } | ||
| 19356 | |||
| 19357 | 60 | temp_zinit.set_item(iMKey, temp != 0); | |
| 19358 | |||
| 19359 |
1/2✓ Branch 0 taken 60 times.
✗ Branch 1 not taken.
|
60 | if(!p_getc(&temp,f)) |
| 19360 | { | ||
| 19361 | ✗ | return qe_invalid; | |
| 19362 | } | ||
| 19363 | |||
| 19364 | 60 | temp_zinit.set_item(iFlippers, temp != 0); | |
| 19365 | |||
| 19366 |
1/2✓ Branch 0 taken 60 times.
✗ Branch 1 not taken.
|
60 | if(!p_getc(&temp,f)) |
| 19367 | { | ||
| 19368 | ✗ | return qe_invalid; | |
| 19369 | } | ||
| 19370 | |||
| 19371 | 60 | temp_zinit.set_item(iBoots, temp != 0); | |
| 19372 | 60 | } | |
| 19373 | 267 | } | |
| 19374 | |||
| 19375 |
2/2✓ Branch 0 taken 207 times.
✓ Branch 1 taken 64 times.
|
271 | if(s_version < 10) |
| 19376 | { | ||
| 19377 | char tempring, tempsword, tempshield, tempwallet, tempbracelet, tempamulet, tempbow; | ||
| 19378 | |||
| 19379 |
1/2✓ Branch 0 taken 64 times.
✗ Branch 1 not taken.
|
64 | if(!p_getc(&tempring,f)) |
| 19380 | { | ||
| 19381 | ✗ | return qe_invalid; | |
| 19382 | } | ||
| 19383 | |||
| 19384 |
1/2✓ Branch 0 taken 64 times.
✗ Branch 1 not taken.
|
64 | if(!p_getc(&tempsword,f)) |
| 19385 | { | ||
| 19386 | ✗ | return qe_invalid; | |
| 19387 | } | ||
| 19388 | |||
| 19389 |
1/2✓ Branch 0 taken 64 times.
✗ Branch 1 not taken.
|
64 | if(!p_getc(&tempshield,f)) |
| 19390 | { | ||
| 19391 | ✗ | return qe_invalid; | |
| 19392 | } | ||
| 19393 | |||
| 19394 |
1/2✓ Branch 0 taken 64 times.
✗ Branch 1 not taken.
|
64 | if(!p_getc(&tempwallet,f)) |
| 19395 | { | ||
| 19396 | ✗ | return qe_invalid; | |
| 19397 | } | ||
| 19398 | |||
| 19399 |
1/2✓ Branch 0 taken 64 times.
✗ Branch 1 not taken.
|
64 | if(!p_getc(&tempbracelet,f)) |
| 19400 | { | ||
| 19401 | ✗ | return qe_invalid; | |
| 19402 | } | ||
| 19403 | |||
| 19404 |
1/2✓ Branch 0 taken 64 times.
✗ Branch 1 not taken.
|
64 | if(!p_getc(&tempamulet,f)) |
| 19405 | { | ||
| 19406 | ✗ | return qe_invalid; | |
| 19407 | } | ||
| 19408 | |||
| 19409 |
1/2✓ Branch 0 taken 64 times.
✗ Branch 1 not taken.
|
64 | if(!p_getc(&tempbow,f)) |
| 19410 | { | ||
| 19411 | ✗ | return qe_invalid; | |
| 19412 | } | ||
| 19413 | |||
| 19414 | //old only | ||
| 19415 |
4/4✓ Branch 0 taken 5 times.
✓ Branch 1 taken 59 times.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 4 times.
|
64 | if((Header->zelda_version == 0x192)&&(Header->build<174)) |
| 19416 | { | ||
| 19417 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
|
4 | tempring=(tempring)?(1<<(tempring-1)):0; |
| 19418 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
|
4 | tempsword=(tempsword)?(1<<(tempsword-1)):0; |
| 19419 |
1/2✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
|
4 | tempshield=(tempshield)?(1<<(tempshield-1)):0; |
| 19420 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
|
4 | tempwallet=(tempwallet)?(1<<(tempwallet-1)):0; |
| 19421 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
|
4 | tempbracelet=(tempbracelet)?(1<<(tempbracelet-1)):0; |
| 19422 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
|
4 | tempamulet=(tempamulet)?(1<<(tempamulet-1)):0; |
| 19423 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
|
4 | tempbow=(tempbow)?(1<<(tempbow-1)):0; |
| 19424 | 4 | } | |
| 19425 | |||
| 19426 | //rings start at level 2... wtf | ||
| 19427 | //account for this -DD | ||
| 19428 | 64 | tempring <<= 1; | |
| 19429 | 64 | addOldStyleFamily(&temp_zinit, itemsbuf, itype_ring, tempring); | |
| 19430 | 64 | addOldStyleFamily(&temp_zinit, itemsbuf, itype_sword, tempsword); | |
| 19431 | 64 | addOldStyleFamily(&temp_zinit, itemsbuf, itype_shield, tempshield); | |
| 19432 | 64 | addOldStyleFamily(&temp_zinit, itemsbuf, itype_wallet, tempwallet); | |
| 19433 | //bracelet ALSO starts at level 2 :-( -DD | ||
| 19434 | 64 | tempbracelet<<=1; | |
| 19435 | 64 | addOldStyleFamily(&temp_zinit, itemsbuf, itype_bracelet, tempbracelet); | |
| 19436 | 64 | addOldStyleFamily(&temp_zinit, itemsbuf, itype_amulet, tempamulet); | |
| 19437 | 64 | addOldStyleFamily(&temp_zinit, itemsbuf, itype_bow, tempbow); | |
| 19438 | |||
| 19439 | //new only | ||
| 19440 |
4/4✓ Branch 0 taken 5 times.
✓ Branch 1 taken 59 times.
✓ Branch 2 taken 4 times.
✓ Branch 3 taken 1 times.
|
64 | if((Header->zelda_version == 0x192)&&(Header->build>173)) |
| 19441 | { | ||
| 19442 |
2/2✓ Branch 0 taken 32 times.
✓ Branch 1 taken 1 times.
|
33 | for(int32_t q=0; q<32; q++) |
| 19443 | { | ||
| 19444 |
1/2✓ Branch 0 taken 32 times.
✗ Branch 1 not taken.
|
32 | if(!p_getc(&padding,f)) |
| 19445 | { | ||
| 19446 | ✗ | return qe_invalid; | |
| 19447 | } | ||
| 19448 | 32 | } | |
| 19449 | 1 | } | |
| 19450 | |||
| 19451 | char tempcandle, tempboomerang, temparrow, tempwhistle; | ||
| 19452 | |||
| 19453 |
1/2✓ Branch 0 taken 64 times.
✗ Branch 1 not taken.
|
64 | if(!p_getc(&tempcandle,f)) |
| 19454 | { | ||
| 19455 | ✗ | return qe_invalid; | |
| 19456 | } | ||
| 19457 | |||
| 19458 |
1/2✓ Branch 0 taken 64 times.
✗ Branch 1 not taken.
|
64 | if(!p_getc(&tempboomerang,f)) |
| 19459 | { | ||
| 19460 | ✗ | return qe_invalid; | |
| 19461 | } | ||
| 19462 | |||
| 19463 |
1/2✓ Branch 0 taken 64 times.
✗ Branch 1 not taken.
|
64 | if(!p_getc(&temparrow,f)) |
| 19464 | { | ||
| 19465 | ✗ | return qe_invalid; | |
| 19466 | } | ||
| 19467 | |||
| 19468 |
1/2✓ Branch 0 taken 64 times.
✗ Branch 1 not taken.
|
64 | if(!p_getc(&temp,f)) |
| 19469 | { | ||
| 19470 | ✗ | return qe_invalid; | |
| 19471 | } | ||
| 19472 | |||
| 19473 | 64 | addOldStyleFamily(&temp_zinit, itemsbuf, itype_potion, temp); | |
| 19474 | |||
| 19475 |
1/2✓ Branch 0 taken 64 times.
✗ Branch 1 not taken.
|
64 | if(!p_getc(&tempwhistle,f)) |
| 19476 | { | ||
| 19477 | ✗ | return qe_invalid; | |
| 19478 | } | ||
| 19479 | |||
| 19480 | //old only | ||
| 19481 |
4/4✓ Branch 0 taken 5 times.
✓ Branch 1 taken 59 times.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 4 times.
|
64 | if((Header->zelda_version == 0x192)&&(Header->build<174)) |
| 19482 | { | ||
| 19483 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
|
4 | tempcandle=(tempcandle)?(1<<(tempcandle-1)):0; |
| 19484 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
|
4 | tempboomerang=(tempboomerang)?(1<<(tempboomerang-1)):0; |
| 19485 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
|
4 | temparrow=(temparrow)?(1<<(temparrow-1)):0; |
| 19486 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
|
4 | tempwhistle=(tempwhistle)?(1<<(tempwhistle-1)):0; |
| 19487 | 4 | } | |
| 19488 | |||
| 19489 | 64 | addOldStyleFamily(&temp_zinit, itemsbuf, itype_candle, tempcandle); | |
| 19490 | 64 | addOldStyleFamily(&temp_zinit, itemsbuf, itype_brang, tempboomerang); | |
| 19491 | 64 | addOldStyleFamily(&temp_zinit, itemsbuf, itype_arrow, temparrow); | |
| 19492 | 64 | addOldStyleFamily(&temp_zinit, itemsbuf, itype_whistle, tempwhistle); | |
| 19493 | //What about the potion...? | ||
| 19494 | |||
| 19495 | 64 | } | |
| 19496 | |||
| 19497 |
2/2✓ Branch 0 taken 18 times.
✓ Branch 1 taken 253 times.
|
271 | if(s_version < 29) |
| 19498 | { | ||
| 19499 | //Oh sure, stick these IN THE MIDDLE OF THE ITEMS, just to make me want | ||
| 19500 | //to jab out my eye... | ||
| 19501 |
1/2✓ Branch 0 taken 253 times.
✗ Branch 1 not taken.
|
253 | if(!p_getc(&padding,f)) |
| 19502 | ✗ | return qe_invalid; | |
| 19503 | 253 | temp_zinit.counter[crBOMBS] = padding; | |
| 19504 | |||
| 19505 |
1/2✓ Branch 0 taken 253 times.
✗ Branch 1 not taken.
|
253 | if(!p_getc(&padding,f)) |
| 19506 | ✗ | return qe_invalid; | |
| 19507 | 253 | temp_zinit.counter[crSBOMBS] = padding; | |
| 19508 | 253 | } | |
| 19509 | |||
| 19510 | //Back to more OLD item code | ||
| 19511 |
2/2✓ Branch 0 taken 207 times.
✓ Branch 1 taken 64 times.
|
271 | if(s_version < 10) |
| 19512 | { | ||
| 19513 |
4/4✓ Branch 0 taken 5 times.
✓ Branch 1 taken 59 times.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 4 times.
|
69 | if((Header->zelda_version > 0x192)|| |
| 19514 | //new only | ||
| 19515 |
1/2✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
|
5 | ((Header->zelda_version == 0x192)&&(Header->build>173))) |
| 19516 | { | ||
| 19517 |
1/2✓ Branch 0 taken 60 times.
✗ Branch 1 not taken.
|
60 | if(!p_getc(&temp,f)) |
| 19518 | { | ||
| 19519 | ✗ | return qe_invalid; | |
| 19520 | } | ||
| 19521 | |||
| 19522 | 60 | addOldStyleFamily(&temp_zinit, itemsbuf, itype_wand, temp); | |
| 19523 | |||
| 19524 |
1/2✓ Branch 0 taken 60 times.
✗ Branch 1 not taken.
|
60 | if(!p_getc(&temp,f)) |
| 19525 | { | ||
| 19526 | ✗ | return qe_invalid; | |
| 19527 | } | ||
| 19528 | |||
| 19529 | 60 | addOldStyleFamily(&temp_zinit, itemsbuf, itype_letter, temp); | |
| 19530 | |||
| 19531 |
1/2✓ Branch 0 taken 60 times.
✗ Branch 1 not taken.
|
60 | if(!p_getc(&temp,f)) |
| 19532 | { | ||
| 19533 | ✗ | return qe_invalid; | |
| 19534 | } | ||
| 19535 | |||
| 19536 | 60 | addOldStyleFamily(&temp_zinit, itemsbuf, itype_lens, temp); | |
| 19537 | |||
| 19538 |
1/2✓ Branch 0 taken 60 times.
✗ Branch 1 not taken.
|
60 | if(!p_getc(&temp,f)) |
| 19539 | { | ||
| 19540 | ✗ | return qe_invalid; | |
| 19541 | } | ||
| 19542 | |||
| 19543 | 60 | addOldStyleFamily(&temp_zinit, itemsbuf, itype_hookshot, temp); | |
| 19544 | |||
| 19545 |
1/2✓ Branch 0 taken 60 times.
✗ Branch 1 not taken.
|
60 | if(!p_getc(&temp,f)) |
| 19546 | { | ||
| 19547 | ✗ | return qe_invalid; | |
| 19548 | } | ||
| 19549 | |||
| 19550 | 60 | addOldStyleFamily(&temp_zinit, itemsbuf, itype_bait, temp); | |
| 19551 | |||
| 19552 |
1/2✓ Branch 0 taken 60 times.
✗ Branch 1 not taken.
|
60 | if(!p_getc(&temp,f)) |
| 19553 | { | ||
| 19554 | ✗ | return qe_invalid; | |
| 19555 | } | ||
| 19556 | |||
| 19557 | 60 | addOldStyleFamily(&temp_zinit, itemsbuf, itype_hammer, temp); | |
| 19558 | |||
| 19559 |
1/2✓ Branch 0 taken 60 times.
✗ Branch 1 not taken.
|
60 | if(!p_getc(&temp,f)) |
| 19560 | { | ||
| 19561 | ✗ | return qe_invalid; | |
| 19562 | } | ||
| 19563 | |||
| 19564 | 60 | addOldStyleFamily(&temp_zinit, itemsbuf, itype_divinefire, temp); | |
| 19565 | |||
| 19566 |
1/2✓ Branch 0 taken 60 times.
✗ Branch 1 not taken.
|
60 | if(!p_getc(&temp,f)) |
| 19567 | { | ||
| 19568 | ✗ | return qe_invalid; | |
| 19569 | } | ||
| 19570 | |||
| 19571 | 60 | addOldStyleFamily(&temp_zinit, itemsbuf, itype_divineescape, temp); | |
| 19572 | |||
| 19573 |
1/2✓ Branch 0 taken 60 times.
✗ Branch 1 not taken.
|
60 | if(!p_getc(&temp,f)) |
| 19574 | { | ||
| 19575 | ✗ | return qe_invalid; | |
| 19576 | } | ||
| 19577 | |||
| 19578 | 60 | addOldStyleFamily(&temp_zinit, itemsbuf, itype_divineprotection, temp); | |
| 19579 | |||
| 19580 |
1/2✓ Branch 0 taken 60 times.
✗ Branch 1 not taken.
|
60 | if(!p_getc(&temp,f)) |
| 19581 | { | ||
| 19582 | ✗ | return qe_invalid; | |
| 19583 | } | ||
| 19584 | |||
| 19585 |
2/2✓ Branch 0 taken 59 times.
✓ Branch 1 taken 1 times.
|
60 | if(Header->zelda_version == 0x192) |
| 19586 | { | ||
| 19587 |
2/2✓ Branch 0 taken 32 times.
✓ Branch 1 taken 1 times.
|
33 | for(int32_t q=0; q<32; q++) |
| 19588 | { | ||
| 19589 |
1/2✓ Branch 0 taken 32 times.
✗ Branch 1 not taken.
|
32 | if(!p_getc(&padding,f)) |
| 19590 | { | ||
| 19591 | ✗ | return qe_invalid; | |
| 19592 | } | ||
| 19593 | 32 | } | |
| 19594 | 1 | } | |
| 19595 | 60 | } | |
| 19596 | 64 | } | |
| 19597 | |||
| 19598 | //old only | ||
| 19599 |
4/4✓ Branch 0 taken 5 times.
✓ Branch 1 taken 266 times.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 4 times.
|
271 | if((Header->zelda_version == 0x192)&&(Header->build<174)) |
| 19600 | { | ||
| 19601 | byte equipment, tmpitm; //bit flags | ||
| 19602 | |||
| 19603 |
1/2✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
|
4 | if(!p_getc(&equipment,f)) |
| 19604 | { | ||
| 19605 | ✗ | return qe_invalid; | |
| 19606 | } | ||
| 19607 | |||
| 19608 | 4 | temp_zinit.set_item(iRaft, get_bit(&equipment, idE_RAFT)!=0); | |
| 19609 | 4 | temp_zinit.set_item(iLadder, get_bit(&equipment, idE_LADDER)!=0); | |
| 19610 | 4 | temp_zinit.set_item(iBook, get_bit(&equipment, idE_BOOK)!=0); | |
| 19611 | 4 | temp_zinit.set_item(iMKey, get_bit(&equipment, idE_KEY)!=0); | |
| 19612 | 4 | temp_zinit.set_item(iFlippers, get_bit(&equipment, idE_FLIPPERS)!=0); | |
| 19613 | 4 | temp_zinit.set_item(iBoots, get_bit(&equipment, idE_BOOTS)!=0); | |
| 19614 | |||
| 19615 | |||
| 19616 |
1/2✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
|
4 | if(!p_getc(&tmpitm,f)) |
| 19617 | { | ||
| 19618 | ✗ | return qe_invalid; | |
| 19619 | } | ||
| 19620 | |||
| 19621 | 4 | temp_zinit.set_item(iWand, get_bit(&tmpitm, idI_WAND)!=0); | |
| 19622 | 4 | temp_zinit.set_item(iLetter, get_bit(&tmpitm, idI_LETTER)!=0); | |
| 19623 | 4 | temp_zinit.set_item(iLens, get_bit(&tmpitm, idI_LENS)!=0); | |
| 19624 | 4 | temp_zinit.set_item(iHookshot, get_bit(&tmpitm, idI_HOOKSHOT)!=0); | |
| 19625 | 4 | temp_zinit.set_item(iBait, get_bit(&tmpitm, idI_BAIT)!=0); | |
| 19626 | 4 | temp_zinit.set_item(iHammer, get_bit(&tmpitm, idI_HAMMER)!=0); | |
| 19627 | 4 | } | |
| 19628 | |||
| 19629 |
1/2✓ Branch 0 taken 271 times.
✗ Branch 1 not taken.
|
271 | if(!p_getc(&tempbyte,f)) |
| 19630 | ✗ | return qe_invalid; | |
| 19631 | 271 | temp_zinit.mcounter[crLIFE] = tempbyte; | |
| 19632 | |||
| 19633 | |||
| 19634 |
2/2✓ Branch 0 taken 64 times.
✓ Branch 1 taken 207 times.
|
271 | if(s_version < 14) |
| 19635 | { | ||
| 19636 | byte temphp; | ||
| 19637 | |||
| 19638 |
1/2✓ Branch 0 taken 64 times.
✗ Branch 1 not taken.
|
64 | if(!p_getc(&temphp,f)) |
| 19639 | { | ||
| 19640 | ✗ | return qe_invalid; | |
| 19641 | } | ||
| 19642 | |||
| 19643 | 64 | temp_zinit.counter[crLIFE]=temphp; | |
| 19644 | |||
| 19645 |
1/2✓ Branch 0 taken 64 times.
✗ Branch 1 not taken.
|
64 | if(!p_getc(&temphp,f)) |
| 19646 | { | ||
| 19647 | ✗ | return qe_invalid; | |
| 19648 | } | ||
| 19649 | |||
| 19650 | 64 | temp_zinit.cont_heart=temphp; | |
| 19651 | 64 | } | |
| 19652 | else | ||
| 19653 | { | ||
| 19654 |
1/2✓ Branch 0 taken 207 times.
✗ Branch 1 not taken.
|
207 | if(!p_igetw(&temp_zinit.counter[crLIFE],f)) |
| 19655 | { | ||
| 19656 | ✗ | return qe_invalid; | |
| 19657 | } | ||
| 19658 | |||
| 19659 |
1/2✓ Branch 0 taken 207 times.
✗ Branch 1 not taken.
|
207 | if(!p_igetw(&temp_zinit.cont_heart,f)) |
| 19660 | { | ||
| 19661 | ✗ | return qe_invalid; | |
| 19662 | } | ||
| 19663 | } | ||
| 19664 | |||
| 19665 |
1/2✓ Branch 0 taken 271 times.
✗ Branch 1 not taken.
|
271 | if(!p_getc(&temp_zinit.hcp,f)) |
| 19666 | { | ||
| 19667 | ✗ | return qe_invalid; | |
| 19668 | } | ||
| 19669 | |||
| 19670 |
2/2✓ Branch 0 taken 64 times.
✓ Branch 1 taken 207 times.
|
271 | if(s_version >= 14) |
| 19671 | { | ||
| 19672 |
1/2✓ Branch 0 taken 207 times.
✗ Branch 1 not taken.
|
207 | if(!p_getc(&temp_zinit.hcp_per_hc,f)) |
| 19673 | { | ||
| 19674 | ✗ | return qe_invalid; | |
| 19675 | } | ||
| 19676 | |||
| 19677 |
1/2✓ Branch 0 taken 207 times.
✗ Branch 1 not taken.
|
207 | if(s_version<16) // July 2007 |
| 19678 | { | ||
| 19679 | ✗ | if(get_qr(qr_BRANGPICKUP+1)) | |
| 19680 | ✗ | temp_zinit.hcp_per_hc = 0xFF; | |
| 19681 | |||
| 19682 | //Dispose of legacy rule | ||
| 19683 | ✗ | set_qr(qr_BRANGPICKUP+1, 0); | |
| 19684 | ✗ | } | |
| 19685 | 207 | } | |
| 19686 | |||
| 19687 |
2/2✓ Branch 0 taken 18 times.
✓ Branch 1 taken 253 times.
|
271 | if(s_version < 29) |
| 19688 | { | ||
| 19689 |
1/2✓ Branch 0 taken 253 times.
✗ Branch 1 not taken.
|
253 | if(!p_getc(&padding,f)) |
| 19690 | ✗ | return qe_invalid; | |
| 19691 | 253 | temp_zinit.mcounter[crBOMBS] = padding; | |
| 19692 | 253 | } | |
| 19693 | |||
| 19694 |
1/2✓ Branch 0 taken 271 times.
✗ Branch 1 not taken.
|
271 | if(!p_getc(&temp_zinit.counter[crKEYS],f)) |
| 19695 | { | ||
| 19696 | ✗ | return qe_invalid; | |
| 19697 | } | ||
| 19698 | |||
| 19699 |
1/2✓ Branch 0 taken 271 times.
✗ Branch 1 not taken.
|
271 | if(!p_igetw(&temp_zinit.counter[crMONEY],f)) |
| 19700 | { | ||
| 19701 | ✗ | return qe_invalid; | |
| 19702 | } | ||
| 19703 | |||
| 19704 |
1/2✓ Branch 0 taken 271 times.
✗ Branch 1 not taken.
|
271 | if(!p_getc(&tempbyte,f)) |
| 19705 | ✗ | return qe_invalid; | |
| 19706 |
2/2✓ Branch 0 taken 2168 times.
✓ Branch 1 taken 271 times.
|
2439 | for(int q = 0; q < 8; ++q) |
| 19707 | 2168 | set_bit(temp_zinit.mcguffin, q+1, get_bitl(tempbyte, q)); | |
| 19708 | |||
| 19709 |
3/6✓ Branch 0 taken 64 times.
✓ Branch 1 taken 207 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 64 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
271 | if(s_version>12 || (Header->zelda_version == 0x211 && Header->build == 18)) |
| 19710 | { | ||
| 19711 |
2/2✓ Branch 0 taken 13248 times.
✓ Branch 1 taken 207 times.
|
13455 | for(int32_t i=0; i<64; i++) |
| 19712 | { | ||
| 19713 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 13248 times.
|
13248 | if(!p_getc(&temp_zinit.map[i],f)) |
| 19714 | { | ||
| 19715 | ✗ | return qe_invalid; | |
| 19716 | } | ||
| 19717 | 13248 | } | |
| 19718 | |||
| 19719 |
2/2✓ Branch 0 taken 13248 times.
✓ Branch 1 taken 207 times.
|
13455 | for(int32_t i=0; i<64; i++) |
| 19720 | { | ||
| 19721 |
1/2✓ Branch 0 taken 13248 times.
✗ Branch 1 not taken.
|
13248 | if(!p_getc(&temp_zinit.compass[i],f)) |
| 19722 | { | ||
| 19723 | ✗ | return qe_invalid; | |
| 19724 | } | ||
| 19725 | 13248 | } | |
| 19726 | 207 | } | |
| 19727 | else | ||
| 19728 | { | ||
| 19729 |
2/2✓ Branch 0 taken 2048 times.
✓ Branch 1 taken 64 times.
|
2112 | for(int32_t i=0; i<32; i++) |
| 19730 | { | ||
| 19731 |
1/2✓ Branch 0 taken 2048 times.
✗ Branch 1 not taken.
|
2048 | if(!p_getc(&temp_zinit.map[i],f)) |
| 19732 | { | ||
| 19733 | ✗ | return qe_invalid; | |
| 19734 | } | ||
| 19735 | 2048 | } | |
| 19736 | |||
| 19737 |
2/2✓ Branch 0 taken 2048 times.
✓ Branch 1 taken 64 times.
|
2112 | for(int32_t i=0; i<32; i++) |
| 19738 | { | ||
| 19739 |
1/2✓ Branch 0 taken 2048 times.
✗ Branch 1 not taken.
|
2048 | if(!p_getc(&temp_zinit.compass[i],f)) |
| 19740 | { | ||
| 19741 | ✗ | return qe_invalid; | |
| 19742 | } | ||
| 19743 | 2048 | } | |
| 19744 | } | ||
| 19745 | |||
| 19746 |
4/4✓ Branch 0 taken 5 times.
✓ Branch 1 taken 266 times.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 4 times.
|
276 | if((Header->zelda_version > 0x192)|| |
| 19747 | //new only | ||
| 19748 |
1/2✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
|
5 | ((Header->zelda_version == 0x192)&&(Header->build>173))) |
| 19749 | { | ||
| 19750 |
3/6✓ Branch 0 taken 60 times.
✓ Branch 1 taken 207 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 60 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
267 | if(s_version>12 || (Header->zelda_version == 0x211 && Header->build == 18)) |
| 19751 | { | ||
| 19752 |
2/2✓ Branch 0 taken 13248 times.
✓ Branch 1 taken 207 times.
|
13455 | for(int32_t i=0; i<64; i++) |
| 19753 | { | ||
| 19754 |
1/2✓ Branch 0 taken 13248 times.
✗ Branch 1 not taken.
|
13248 | if(!p_getc(&temp_zinit.boss_key[i],f)) |
| 19755 | { | ||
| 19756 | ✗ | return qe_invalid; | |
| 19757 | } | ||
| 19758 | 13248 | } | |
| 19759 | 207 | } | |
| 19760 | else | ||
| 19761 | { | ||
| 19762 |
2/2✓ Branch 0 taken 1920 times.
✓ Branch 1 taken 60 times.
|
1980 | for(int32_t i=0; i<32; i++) |
| 19763 | { | ||
| 19764 |
1/2✓ Branch 0 taken 1920 times.
✗ Branch 1 not taken.
|
1920 | if(!p_getc(&temp_zinit.boss_key[i],f)) |
| 19765 | { | ||
| 19766 | ✗ | return qe_invalid; | |
| 19767 | } | ||
| 19768 | 1920 | } | |
| 19769 | } | ||
| 19770 | 267 | } | |
| 19771 | |||
| 19772 | byte tmpmisc[16]; | ||
| 19773 |
2/2✓ Branch 0 taken 4336 times.
✓ Branch 1 taken 271 times.
|
4607 | for(int32_t i=0; i<16; i++) |
| 19774 |
1/2✓ Branch 0 taken 4336 times.
✗ Branch 1 not taken.
|
4336 | if(!p_getc(&tmpmisc[i],f)) |
| 19775 | ✗ | return qe_invalid; | |
| 19776 | 271 | temp_zinit.flags.set(INIT_FL_CONTPERCENT,get_bit(tmpmisc,0)); | |
| 19777 | 271 | temp_zinit.magicdrainrate = get_bit(tmpmisc,1) ? 1 : 2; //Double Magic flag | |
| 19778 | 271 | temp_zinit.flags.set(INIT_FL_CANSLASH,get_bit(tmpmisc,2)); | |
| 19779 | |||
| 19780 |
4/4✓ Branch 0 taken 207 times.
✓ Branch 1 taken 64 times.
✓ Branch 2 taken 256 times.
✓ Branch 3 taken 64 times.
|
527 | if(s_version < 15) for(int32_t i=0; i<4; i++) |
| 19781 |
1/2✓ Branch 0 taken 256 times.
✗ Branch 1 not taken.
|
256 | if(!p_getc(&sword_hearts[i],f)) |
| 19782 | 64 | return qe_invalid; | |
| 19783 | |||
| 19784 |
1/2✓ Branch 0 taken 271 times.
✗ Branch 1 not taken.
|
271 | if(!p_getc(&temp_zinit.last_map,f)) |
| 19785 | { | ||
| 19786 | ✗ | return qe_invalid; | |
| 19787 | } | ||
| 19788 | |||
| 19789 |
1/2✓ Branch 0 taken 271 times.
✗ Branch 1 not taken.
|
271 | if(!p_getc(&temp_zinit.last_screen,f)) |
| 19790 | { | ||
| 19791 | ✗ | return qe_invalid; | |
| 19792 | } | ||
| 19793 | |||
| 19794 |
2/2✓ Branch 0 taken 64 times.
✓ Branch 1 taken 207 times.
|
271 | if(s_version < 14) |
| 19795 | { | ||
| 19796 | byte tempmp; | ||
| 19797 | |||
| 19798 |
1/2✓ Branch 0 taken 64 times.
✗ Branch 1 not taken.
|
64 | if(!p_getc(&tempmp,f)) |
| 19799 | { | ||
| 19800 | ✗ | return qe_invalid; | |
| 19801 | } | ||
| 19802 | |||
| 19803 | 64 | temp_zinit.mcounter[crMAGIC]=tempmp; | |
| 19804 | |||
| 19805 |
1/2✓ Branch 0 taken 64 times.
✗ Branch 1 not taken.
|
64 | if(!p_getc(&tempmp,f)) |
| 19806 | { | ||
| 19807 | ✗ | return qe_invalid; | |
| 19808 | } | ||
| 19809 | |||
| 19810 | 64 | temp_zinit.counter[crMAGIC]=tempmp; | |
| 19811 | 64 | } | |
| 19812 | else | ||
| 19813 | { | ||
| 19814 |
1/2✓ Branch 0 taken 207 times.
✗ Branch 1 not taken.
|
207 | if(!p_igetw(&temp_zinit.mcounter[crMAGIC],f)) |
| 19815 | { | ||
| 19816 | ✗ | return qe_invalid; | |
| 19817 | } | ||
| 19818 | |||
| 19819 |
1/2✓ Branch 0 taken 207 times.
✗ Branch 1 not taken.
|
207 | if(!p_igetw(&temp_zinit.counter[crMAGIC],f)) |
| 19820 | { | ||
| 19821 | ✗ | return qe_invalid; | |
| 19822 | } | ||
| 19823 | } | ||
| 19824 | |||
| 19825 | |||
| 19826 |
2/2✓ Branch 0 taken 64 times.
✓ Branch 1 taken 207 times.
|
271 | if(s_version < 15) |
| 19827 | { | ||
| 19828 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 64 times.
|
64 | if(s_version < 12) |
| 19829 | { | ||
| 19830 | 64 | temp_zinit.mcounter[crMAGIC]*=32; | |
| 19831 | 64 | temp_zinit.counter[crMAGIC]*=32; | |
| 19832 | 64 | } | |
| 19833 | |||
| 19834 |
2/2✓ Branch 0 taken 256 times.
✓ Branch 1 taken 64 times.
|
320 | for(int32_t i=0; i<4; i++) |
| 19835 | { | ||
| 19836 |
1/2✓ Branch 0 taken 256 times.
✗ Branch 1 not taken.
|
256 | if(!p_getc(&beam_hearts[i],f)) |
| 19837 | { | ||
| 19838 | ✗ | return qe_invalid; | |
| 19839 | } | ||
| 19840 | 256 | } | |
| 19841 | |||
| 19842 |
1/2✓ Branch 0 taken 64 times.
✗ Branch 1 not taken.
|
64 | if(!p_getc(&beam_percent,f)) |
| 19843 | { | ||
| 19844 | ✗ | return qe_invalid; | |
| 19845 | } | ||
| 19846 | 64 | } | |
| 19847 | else | ||
| 19848 | { | ||
| 19849 |
1/2✓ Branch 0 taken 207 times.
✗ Branch 1 not taken.
|
207 | if(!p_getc(&temp_zinit.bomb_ratio,f)) |
| 19850 | ✗ | return qe_invalid; | |
| 19851 |
1/2✓ Branch 0 taken 207 times.
✗ Branch 1 not taken.
|
207 | if(temp_zinit.bomb_ratio < 1) |
| 19852 | ✗ | temp_zinit.bomb_ratio = 1; | |
| 19853 | 207 | else bomb_ratio = temp_zinit.bomb_ratio; //jank | |
| 19854 | } | ||
| 19855 | |||
| 19856 |
2/2✓ Branch 0 taken 207 times.
✓ Branch 1 taken 64 times.
|
271 | if(s_version < 15) |
| 19857 | { | ||
| 19858 | byte tempbp; | ||
| 19859 | |||
| 19860 |
2/2✓ Branch 0 taken 256 times.
✓ Branch 1 taken 64 times.
|
320 | for(int32_t i=0; i<4; i++) |
| 19861 | { | ||
| 19862 |
2/4✓ Branch 0 taken 256 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 256 times.
✗ Branch 3 not taken.
|
256 | if(!(s_version < 14 ? p_getc(&tempbp,f) : p_igetw(&tempbp,f))) |
| 19863 | { | ||
| 19864 | ✗ | return qe_invalid; | |
| 19865 | } | ||
| 19866 | |||
| 19867 | 256 | beam_power[i]=tempbp; | |
| 19868 | 256 | } | |
| 19869 | |||
| 19870 |
1/2✓ Branch 0 taken 64 times.
✗ Branch 1 not taken.
|
64 | if(!p_getc(&hookshot_links,f)) |
| 19871 | { | ||
| 19872 | ✗ | return qe_invalid; | |
| 19873 | } | ||
| 19874 | |||
| 19875 |
1/2✓ Branch 0 taken 64 times.
✗ Branch 1 not taken.
|
64 | if(s_version>6) |
| 19876 | { | ||
| 19877 | ✗ | if(!p_getc(&hookshot_length,f)) | |
| 19878 | { | ||
| 19879 | ✗ | return qe_invalid; | |
| 19880 | } | ||
| 19881 | |||
| 19882 | ✗ | if(!p_getc(&longshot_links,f)) | |
| 19883 | { | ||
| 19884 | ✗ | return qe_invalid; | |
| 19885 | } | ||
| 19886 | |||
| 19887 | ✗ | if(!p_getc(&longshot_length,f)) | |
| 19888 | { | ||
| 19889 | ✗ | return qe_invalid; | |
| 19890 | } | ||
| 19891 | ✗ | } | |
| 19892 | 64 | } | |
| 19893 | |||
| 19894 |
1/2✓ Branch 0 taken 271 times.
✗ Branch 1 not taken.
|
271 | if(!p_getc(&temp_zinit.msg_more_x,f)) |
| 19895 | { | ||
| 19896 | ✗ | return qe_invalid; | |
| 19897 | } | ||
| 19898 | |||
| 19899 |
1/2✓ Branch 0 taken 271 times.
✗ Branch 1 not taken.
|
271 | if(!p_getc(&temp_zinit.msg_more_y,f)) |
| 19900 | { | ||
| 19901 | ✗ | return qe_invalid; | |
| 19902 | } | ||
| 19903 | |||
| 19904 |
1/2✓ Branch 0 taken 271 times.
✗ Branch 1 not taken.
|
271 | if(!p_getc(&subscr_mode,f)) |
| 19905 | ✗ | return qe_invalid; | |
| 19906 | |||
| 19907 | //old only | ||
| 19908 |
4/4✓ Branch 0 taken 5 times.
✓ Branch 1 taken 266 times.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 4 times.
|
271 | if((Header->zelda_version == 0x192)&&(Header->build<174)) |
| 19909 | { | ||
| 19910 |
2/2✓ Branch 0 taken 128 times.
✓ Branch 1 taken 4 times.
|
132 | for(int32_t i=0; i<32; i++) |
| 19911 | { | ||
| 19912 |
1/2✓ Branch 0 taken 128 times.
✗ Branch 1 not taken.
|
128 | if(!p_getc(&temp_zinit.boss_key[i],f)) |
| 19913 | { | ||
| 19914 | ✗ | return qe_invalid; | |
| 19915 | } | ||
| 19916 | 128 | } | |
| 19917 | 4 | } | |
| 19918 | |||
| 19919 |
5/6✓ Branch 0 taken 5 times.
✓ Branch 1 taken 266 times.
✓ Branch 2 taken 5 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✓ Branch 5 taken 4 times.
|
271 | if((Header->zelda_version > 0x192)||((Header->zelda_version == 0x192)&&(Header->build>173))) //new only |
| 19920 | { | ||
| 19921 |
2/2✓ Branch 0 taken 60 times.
✓ Branch 1 taken 207 times.
|
267 | if(s_version <= 10) |
| 19922 | { | ||
| 19923 |
1/2✓ Branch 0 taken 60 times.
✗ Branch 1 not taken.
|
60 | if(!p_getc(&tempbyte,f)) |
| 19924 | { | ||
| 19925 | ✗ | return qe_invalid; | |
| 19926 | } | ||
| 19927 | |||
| 19928 | 60 | temp_zinit.start_dmap = (word)tempbyte; | |
| 19929 | 60 | } | |
| 19930 | else | ||
| 19931 | { | ||
| 19932 |
1/2✓ Branch 0 taken 207 times.
✗ Branch 1 not taken.
|
207 | if(!p_igetw(&temp_zinit.start_dmap,f)) |
| 19933 | { | ||
| 19934 | ✗ | return qe_invalid; | |
| 19935 | } | ||
| 19936 | } | ||
| 19937 | |||
| 19938 |
1/2✓ Branch 0 taken 267 times.
✗ Branch 1 not taken.
|
267 | if(!p_getc(&temp_zinit.heroAnimationStyle,f)) |
| 19939 | { | ||
| 19940 | ✗ | return qe_invalid; | |
| 19941 | } | ||
| 19942 | 267 | } | |
| 19943 | |||
| 19944 |
4/4✓ Branch 0 taken 207 times.
✓ Branch 1 taken 64 times.
✓ Branch 2 taken 18 times.
✓ Branch 3 taken 189 times.
|
271 | if(s_version>1 && s_version < 29) |
| 19945 | { | ||
| 19946 |
1/2✓ Branch 0 taken 189 times.
✗ Branch 1 not taken.
|
189 | if(!p_getc(&padding,f)) |
| 19947 | ✗ | return qe_invalid; | |
| 19948 | 189 | temp_zinit.counter[crARROWS] = padding; | |
| 19949 | |||
| 19950 |
1/2✓ Branch 0 taken 189 times.
✗ Branch 1 not taken.
|
189 | if(!p_getc(&padding,f)) |
| 19951 | ✗ | return qe_invalid; | |
| 19952 | 189 | temp_zinit.mcounter[crARROWS] = padding; | |
| 19953 | 189 | } | |
| 19954 | |||
| 19955 |
2/2✓ Branch 0 taken 64 times.
✓ Branch 1 taken 207 times.
|
271 | if(s_version>2) |
| 19956 | { | ||
| 19957 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 207 times.
|
207 | if(s_version <= 10) |
| 19958 | { | ||
| 19959 | ✗ | for(int32_t i=0; i<OLDMAXLEVELS; i++) | |
| 19960 | { | ||
| 19961 | ✗ | if(!p_getc(&(temp_zinit.level_keys[i]),f)) | |
| 19962 | { | ||
| 19963 | ✗ | return qe_invalid; | |
| 19964 | } | ||
| 19965 | ✗ | } | |
| 19966 | ✗ | } | |
| 19967 | else | ||
| 19968 | { | ||
| 19969 |
2/2✓ Branch 0 taken 105984 times.
✓ Branch 1 taken 207 times.
|
106191 | for(int32_t i=0; i<MAXLEVELS; i++) |
| 19970 | { | ||
| 19971 |
1/2✓ Branch 0 taken 105984 times.
✗ Branch 1 not taken.
|
105984 | if(!p_getc(&(temp_zinit.level_keys[i]),f)) |
| 19972 | { | ||
| 19973 | ✗ | return qe_invalid; | |
| 19974 | } | ||
| 19975 | 105984 | } | |
| 19976 | } | ||
| 19977 | 207 | } | |
| 19978 | |||
| 19979 |
2/2✓ Branch 0 taken 64 times.
✓ Branch 1 taken 207 times.
|
271 | if(s_version>3) |
| 19980 | { | ||
| 19981 |
1/2✓ Branch 0 taken 207 times.
✗ Branch 1 not taken.
|
207 | if(!p_igetw(&temp_zinit.ss_grid_x,f)) |
| 19982 | { | ||
| 19983 | ✗ | return qe_invalid; | |
| 19984 | } | ||
| 19985 | |||
| 19986 |
1/2✓ Branch 0 taken 207 times.
✗ Branch 1 not taken.
|
207 | if(!p_igetw(&temp_zinit.ss_grid_y,f)) |
| 19987 | { | ||
| 19988 | ✗ | return qe_invalid; | |
| 19989 | } | ||
| 19990 | |||
| 19991 |
1/2✓ Branch 0 taken 207 times.
✗ Branch 1 not taken.
|
207 | if(!p_igetw(&temp_zinit.ss_grid_xofs,f)) |
| 19992 | { | ||
| 19993 | ✗ | return qe_invalid; | |
| 19994 | } | ||
| 19995 | |||
| 19996 |
1/2✓ Branch 0 taken 207 times.
✗ Branch 1 not taken.
|
207 | if(!p_igetw(&temp_zinit.ss_grid_yofs,f)) |
| 19997 | { | ||
| 19998 | ✗ | return qe_invalid; | |
| 19999 | } | ||
| 20000 | |||
| 20001 |
1/2✓ Branch 0 taken 207 times.
✗ Branch 1 not taken.
|
207 | if(!p_igetw(&temp_zinit.ss_grid_color,f)) |
| 20002 | { | ||
| 20003 | ✗ | return qe_invalid; | |
| 20004 | } | ||
| 20005 | |||
| 20006 |
1/2✓ Branch 0 taken 207 times.
✗ Branch 1 not taken.
|
207 | if(!p_igetw(&temp_zinit.ss_bbox_1_color,f)) |
| 20007 | { | ||
| 20008 | ✗ | return qe_invalid; | |
| 20009 | } | ||
| 20010 | |||
| 20011 |
1/2✓ Branch 0 taken 207 times.
✗ Branch 1 not taken.
|
207 | if(!p_igetw(&temp_zinit.ss_bbox_2_color,f)) |
| 20012 | { | ||
| 20013 | ✗ | return qe_invalid; | |
| 20014 | } | ||
| 20015 | |||
| 20016 |
1/2✓ Branch 0 taken 207 times.
✗ Branch 1 not taken.
|
207 | if(!p_igetw(&temp_zinit.ss_flags,f)) |
| 20017 | { | ||
| 20018 | ✗ | return qe_invalid; | |
| 20019 | } | ||
| 20020 | |||
| 20021 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 207 times.
|
207 | temp_zinit.ss_grid_x=zc_max(temp_zinit.ss_grid_x,1); |
| 20022 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 207 times.
|
207 | temp_zinit.ss_grid_y=zc_max(temp_zinit.ss_grid_y,1); |
| 20023 | 207 | } | |
| 20024 | |||
| 20025 |
3/4✓ Branch 0 taken 207 times.
✓ Branch 1 taken 64 times.
✓ Branch 2 taken 207 times.
✗ Branch 3 not taken.
|
271 | if(s_version>4 && s_version<15) |
| 20026 | { | ||
| 20027 | ✗ | if(!p_getc(&moving_fairy_hearts,f)) | |
| 20028 | { | ||
| 20029 | ✗ | return qe_invalid; | |
| 20030 | } | ||
| 20031 | |||
| 20032 | ✗ | if(!p_getc(&moving_fairy_heart_percent,f)) | |
| 20033 | { | ||
| 20034 | ✗ | return qe_invalid; | |
| 20035 | } | ||
| 20036 | ✗ | } | |
| 20037 | |||
| 20038 |
3/4✓ Branch 0 taken 207 times.
✓ Branch 1 taken 64 times.
✓ Branch 2 taken 207 times.
✗ Branch 3 not taken.
|
271 | if(s_version>5 && s_version < 10) |
| 20039 | { | ||
| 20040 | ✗ | if(!p_getc(&temp,f)) | |
| 20041 | { | ||
| 20042 | ✗ | return qe_invalid; | |
| 20043 | } | ||
| 20044 | |||
| 20045 | ✗ | addOldStyleFamily(&temp_zinit, itemsbuf, itype_quiver, temp); | |
| 20046 | ✗ | } | |
| 20047 | |||
| 20048 |
3/4✓ Branch 0 taken 207 times.
✓ Branch 1 taken 64 times.
✓ Branch 2 taken 207 times.
✗ Branch 3 not taken.
|
271 | if(s_version>6 && s_version<15) |
| 20049 | { | ||
| 20050 | ✗ | if(!p_getc(&stationary_fairy_hearts,f)) | |
| 20051 | { | ||
| 20052 | ✗ | return qe_invalid; | |
| 20053 | } | ||
| 20054 | |||
| 20055 | ✗ | if(!p_getc(&stationary_fairy_heart_percent,f)) | |
| 20056 | { | ||
| 20057 | ✗ | return qe_invalid; | |
| 20058 | } | ||
| 20059 | |||
| 20060 | ✗ | if(!p_getc(&moving_fairy_magic,f)) | |
| 20061 | { | ||
| 20062 | ✗ | return qe_invalid; | |
| 20063 | } | ||
| 20064 | |||
| 20065 | ✗ | if(!p_getc(&moving_fairy_magic_percent,f)) | |
| 20066 | { | ||
| 20067 | ✗ | return qe_invalid; | |
| 20068 | } | ||
| 20069 | |||
| 20070 | ✗ | if(!p_getc(&stationary_fairy_magic,f)) | |
| 20071 | { | ||
| 20072 | ✗ | return qe_invalid; | |
| 20073 | } | ||
| 20074 | |||
| 20075 | ✗ | if(!p_getc(&stationary_fairy_magic_percent,f)) | |
| 20076 | { | ||
| 20077 | ✗ | return qe_invalid; | |
| 20078 | } | ||
| 20079 | |||
| 20080 | ✗ | if(!p_getc(&blue_potion_hearts,f)) | |
| 20081 | { | ||
| 20082 | ✗ | return qe_invalid; | |
| 20083 | } | ||
| 20084 | |||
| 20085 | ✗ | if(!p_getc(&blue_potion_heart_percent,f)) | |
| 20086 | { | ||
| 20087 | ✗ | return qe_invalid; | |
| 20088 | } | ||
| 20089 | |||
| 20090 | ✗ | if(!p_getc(&red_potion_hearts,f)) | |
| 20091 | { | ||
| 20092 | ✗ | return qe_invalid; | |
| 20093 | } | ||
| 20094 | |||
| 20095 | ✗ | if(!p_getc(&red_potion_heart_percent,f)) | |
| 20096 | { | ||
| 20097 | ✗ | return qe_invalid; | |
| 20098 | } | ||
| 20099 | |||
| 20100 | ✗ | if(!p_getc(&blue_potion_magic,f)) | |
| 20101 | { | ||
| 20102 | ✗ | return qe_invalid; | |
| 20103 | } | ||
| 20104 | |||
| 20105 | ✗ | if(!p_getc(&blue_potion_magic_percent,f)) | |
| 20106 | { | ||
| 20107 | ✗ | return qe_invalid; | |
| 20108 | } | ||
| 20109 | |||
| 20110 | ✗ | if(!p_getc(&red_potion_magic,f)) | |
| 20111 | { | ||
| 20112 | ✗ | return qe_invalid; | |
| 20113 | } | ||
| 20114 | |||
| 20115 | ✗ | if(!p_getc(&red_potion_magic_percent,f)) | |
| 20116 | { | ||
| 20117 | ✗ | return qe_invalid; | |
| 20118 | } | ||
| 20119 | ✗ | } | |
| 20120 | |||
| 20121 |
2/2✓ Branch 0 taken 64 times.
✓ Branch 1 taken 207 times.
|
271 | if(s_version>6) |
| 20122 |
1/2✓ Branch 0 taken 207 times.
✗ Branch 1 not taken.
|
207 | if(!p_getc(&padding,f)) |
| 20123 | ✗ | return qe_invalid; | |
| 20124 | |||
| 20125 |
2/2✓ Branch 0 taken 64 times.
✓ Branch 1 taken 207 times.
|
271 | if(s_version>7) |
| 20126 | { | ||
| 20127 |
1/2✓ Branch 0 taken 207 times.
✗ Branch 1 not taken.
|
207 | if(!p_getc(&padding,f)) |
| 20128 | { | ||
| 20129 | ✗ | return qe_invalid; | |
| 20130 | } | ||
| 20131 | 207 | } | |
| 20132 | |||
| 20133 |
2/2✓ Branch 0 taken 64 times.
✓ Branch 1 taken 207 times.
|
271 | if(s_version>8) |
| 20134 | { | ||
| 20135 |
1/2✓ Branch 0 taken 207 times.
✗ Branch 1 not taken.
|
207 | if(!p_igetw(&temp_zinit.mcounter[crMONEY],f)) |
| 20136 | { | ||
| 20137 | ✗ | return qe_invalid; | |
| 20138 | } | ||
| 20139 | |||
| 20140 |
1/2✓ Branch 0 taken 207 times.
✗ Branch 1 not taken.
|
207 | if(!p_igetw(&temp_zinit.mcounter[crKEYS],f)) |
| 20141 | { | ||
| 20142 | ✗ | return qe_invalid; | |
| 20143 | } | ||
| 20144 | 207 | } | |
| 20145 | |||
| 20146 |
2/2✓ Branch 0 taken 207 times.
✓ Branch 1 taken 64 times.
|
271 | if(s_version>16) |
| 20147 | { | ||
| 20148 |
1/2✓ Branch 0 taken 207 times.
✗ Branch 1 not taken.
|
207 | if(!p_getc(&tempbyte,f)) |
| 20149 | { | ||
| 20150 | ✗ | return qe_invalid; | |
| 20151 | } | ||
| 20152 | 207 | temp_zinit.gravity = tempbyte*100; | |
| 20153 |
1/2✓ Branch 0 taken 207 times.
✗ Branch 1 not taken.
|
207 | if(!p_igetw(&temp_zinit.terminalv,f)) |
| 20154 | { | ||
| 20155 | ✗ | return qe_invalid; | |
| 20156 | } | ||
| 20157 | |||
| 20158 |
1/2✓ Branch 0 taken 207 times.
✗ Branch 1 not taken.
|
207 | if(!p_getc(&temp_zinit.msg_speed,f)) |
| 20159 | { | ||
| 20160 | ✗ | return qe_invalid; | |
| 20161 | } | ||
| 20162 | |||
| 20163 |
1/2✓ Branch 0 taken 207 times.
✗ Branch 1 not taken.
|
207 | if(!p_getc(&padding,f)) |
| 20164 | { | ||
| 20165 | ✗ | return qe_invalid; | |
| 20166 | } | ||
| 20167 | |||
| 20168 |
1/2✓ Branch 0 taken 207 times.
✗ Branch 1 not taken.
|
207 | if(!p_getc(&temp_zinit.jump_hero_layer_threshold,f)) |
| 20169 | { | ||
| 20170 | ✗ | return qe_invalid; | |
| 20171 | } | ||
| 20172 | 207 | } | |
| 20173 |
2/2✓ Branch 0 taken 52 times.
✓ Branch 1 taken 12 times.
|
64 | else if (replay_version_check(0, 13)) |
| 20174 | 12 | temp_zinit.msg_speed = 0; | |
| 20175 | |||
| 20176 |
2/2✓ Branch 0 taken 64 times.
✓ Branch 1 taken 207 times.
|
271 | if(s_version>17) |
| 20177 | { | ||
| 20178 |
1/2✓ Branch 0 taken 207 times.
✗ Branch 1 not taken.
|
207 | if(!p_getc(&temp_zinit.msg_more_is_offset,f)) |
| 20179 | { | ||
| 20180 | ✗ | return qe_invalid; | |
| 20181 | } | ||
| 20182 | 207 | } | |
| 20183 | |||
| 20184 | //expaned init data for larger values in 2.55 | ||
| 20185 |
2/2✓ Branch 0 taken 253 times.
✓ Branch 1 taken 18 times.
|
271 | if ( s_version >= 19 ) //expand init data bombs, sbombs, and arrows to 0xFFFF |
| 20186 | { | ||
| 20187 |
1/2✓ Branch 0 taken 18 times.
✗ Branch 1 not taken.
|
18 | if(!p_igetw(&temp_zinit.counter[crBOMBS],f)) |
| 20188 | { | ||
| 20189 | ✗ | return qe_invalid; | |
| 20190 | } | ||
| 20191 |
1/2✓ Branch 0 taken 18 times.
✗ Branch 1 not taken.
|
18 | if(!p_igetw(&temp_zinit.counter[crSBOMBS],f)) |
| 20192 | { | ||
| 20193 | ✗ | return qe_invalid; | |
| 20194 | } | ||
| 20195 |
1/2✓ Branch 0 taken 18 times.
✗ Branch 1 not taken.
|
18 | if(!p_igetw(&temp_zinit.mcounter[crBOMBS],f)) |
| 20196 | { | ||
| 20197 | ✗ | return qe_invalid; | |
| 20198 | } | ||
| 20199 |
1/2✓ Branch 0 taken 18 times.
✗ Branch 1 not taken.
|
18 | if(!p_igetw(&temp_zinit.mcounter[crSBOMBS],f)) |
| 20200 | { | ||
| 20201 | ✗ | return qe_invalid; | |
| 20202 | } | ||
| 20203 |
1/2✓ Branch 0 taken 18 times.
✗ Branch 1 not taken.
|
18 | if(!p_igetw(&temp_zinit.counter[crARROWS],f)) |
| 20204 | { | ||
| 20205 | ✗ | return qe_invalid; | |
| 20206 | } | ||
| 20207 |
1/2✓ Branch 0 taken 18 times.
✗ Branch 1 not taken.
|
18 | if(!p_igetw(&temp_zinit.mcounter[crARROWS],f)) |
| 20208 | { | ||
| 20209 | ✗ | return qe_invalid; | |
| 20210 | } | ||
| 20211 | |||
| 20212 | 18 | } | |
| 20213 |
2/2✓ Branch 0 taken 18 times.
✓ Branch 1 taken 253 times.
|
271 | if ( s_version >= 20 ) |
| 20214 | { | ||
| 20215 |
1/2✓ Branch 0 taken 18 times.
✗ Branch 1 not taken.
|
18 | if(!p_igetw(&temp_zinit.heroStep,f)) |
| 20216 | { | ||
| 20217 | ✗ | return qe_invalid; | |
| 20218 | } | ||
| 20219 | 18 | } | |
| 20220 | else | ||
| 20221 | { | ||
| 20222 | 253 | temp_zinit.heroStep = 150; //1.5 pixels per frame | |
| 20223 | } | ||
| 20224 |
2/2✓ Branch 0 taken 18 times.
✓ Branch 1 taken 253 times.
|
271 | if ( s_version >= 21 ) |
| 20225 | { | ||
| 20226 |
1/2✓ Branch 0 taken 18 times.
✗ Branch 1 not taken.
|
18 | if(!p_igetw(&temp_zinit.subscrSpeed,f)) |
| 20227 | { | ||
| 20228 | ✗ | return qe_invalid; | |
| 20229 | } | ||
| 20230 | 18 | } | |
| 20231 | else | ||
| 20232 | { | ||
| 20233 | 253 | temp_zinit.subscrSpeed = 1; //3 pixels per frame | |
| 20234 | } | ||
| 20235 | //old only | ||
| 20236 |
4/4✓ Branch 0 taken 5 times.
✓ Branch 1 taken 266 times.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 4 times.
|
271 | if((Header->zelda_version == 0x192)&&(Header->build<174)) |
| 20237 | { | ||
| 20238 | byte items2; | ||
| 20239 | |||
| 20240 |
1/2✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
|
4 | if(!p_getc(&items2,f)) |
| 20241 | { | ||
| 20242 | ✗ | return qe_invalid; | |
| 20243 | } | ||
| 20244 | |||
| 20245 | 4 | temp_zinit.set_item(iDivineFire, get_bit(&items2, idI_DFIRE)!=0); | |
| 20246 | 4 | temp_zinit.set_item(iDivineEscape, get_bit(&items2, idI_FWIND)!=0); | |
| 20247 | 4 | temp_zinit.set_item(iDivineProtection, get_bit(&items2, idI_NLOVE)!=0); | |
| 20248 | 4 | } | |
| 20249 | |||
| 20250 |
2/2✓ Branch 0 taken 266 times.
✓ Branch 1 taken 5 times.
|
271 | if(Header->zelda_version < 0x193) |
| 20251 | { | ||
| 20252 |
2/2✓ Branch 0 taken 480 times.
✓ Branch 1 taken 5 times.
|
485 | for(int32_t q=0; q<96; q++) |
| 20253 | { | ||
| 20254 |
1/2✓ Branch 0 taken 480 times.
✗ Branch 1 not taken.
|
480 | if(!p_getc(&padding,f)) |
| 20255 | { | ||
| 20256 | ✗ | return qe_invalid; | |
| 20257 | } | ||
| 20258 | 480 | } | |
| 20259 | |||
| 20260 | //new only | ||
| 20261 |
3/4✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4 times.
✓ Branch 3 taken 1 times.
|
5 | if((Header->zelda_version == 0x192)&&(Header->build>173)) |
| 20262 | { | ||
| 20263 |
1/2✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
|
1 | if(!p_getc(&padding,f)) |
| 20264 | { | ||
| 20265 | ✗ | return qe_invalid; | |
| 20266 | } | ||
| 20267 | |||
| 20268 |
1/2✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
|
1 | if(!p_getc(&padding,f)) |
| 20269 | { | ||
| 20270 | ✗ | return qe_invalid; | |
| 20271 | } | ||
| 20272 | 1 | } | |
| 20273 | 5 | } | |
| 20274 | 271 | } | |
| 20275 | |||
| 20276 |
3/6✓ Branch 0 taken 207 times.
✓ Branch 1 taken 82 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 207 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
289 | if((Header->zelda_version < 0x211)||((Header->zelda_version == 0x211)&&(Header->build<15))) |
| 20277 | { | ||
| 20278 | //temp_zinit.shield=i_smallshield; | ||
| 20279 | 82 | int32_t sshieldid = getItemID(itemsbuf, itype_shield, i_smallshield); | |
| 20280 | |||
| 20281 |
1/2✓ Branch 0 taken 82 times.
✗ Branch 1 not taken.
|
82 | if(sshieldid != -1) |
| 20282 | 82 | temp_zinit.set_item(sshieldid, true); | |
| 20283 | 82 | } | |
| 20284 | |||
| 20285 |
5/6✓ Branch 0 taken 271 times.
✓ Branch 1 taken 18 times.
✓ Branch 2 taken 5 times.
✓ Branch 3 taken 266 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 5 times.
|
289 | if((Header->zelda_version < 0x192)||((Header->zelda_version == 0x192)&&(Header->build<27))) |
| 20286 | { | ||
| 20287 | 18 | temp_zinit.mcounter[crLIFE]=3; | |
| 20288 | 18 | temp_zinit.counter[crLIFE]=3; | |
| 20289 | 18 | temp_zinit.cont_heart=3; | |
| 20290 | 18 | temp_zinit.mcounter[crBOMBS]=8; | |
| 20291 | 18 | } | |
| 20292 | |||
| 20293 |
5/6✓ Branch 0 taken 271 times.
✓ Branch 1 taken 18 times.
✓ Branch 2 taken 5 times.
✓ Branch 3 taken 266 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 5 times.
|
289 | if((Header->zelda_version < 0x192)||((Header->zelda_version == 0x192)&&(Header->build<50))) |
| 20294 | { | ||
| 20295 | 18 | sword_hearts[0]=0; | |
| 20296 | 18 | sword_hearts[1]=5; | |
| 20297 | 18 | sword_hearts[2]=12; | |
| 20298 | 18 | sword_hearts[3]=21; | |
| 20299 | 18 | } | |
| 20300 | |||
| 20301 |
5/6✓ Branch 0 taken 271 times.
✓ Branch 1 taken 18 times.
✓ Branch 2 taken 5 times.
✓ Branch 3 taken 266 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 5 times.
|
289 | if((Header->zelda_version < 0x192)||((Header->zelda_version == 0x192)&&(Header->build<51))) |
| 20302 | { | ||
| 20303 | 18 | temp_zinit.last_map=0; | |
| 20304 | 18 | temp_zinit.last_screen=0; | |
| 20305 | 18 | } | |
| 20306 | |||
| 20307 |
5/6✓ Branch 0 taken 271 times.
✓ Branch 1 taken 18 times.
✓ Branch 2 taken 5 times.
✓ Branch 3 taken 266 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 5 times.
|
289 | if((Header->zelda_version < 0x192)||((Header->zelda_version == 0x192)&&(Header->build<68))) |
| 20308 | { | ||
| 20309 | 18 | temp_zinit.mcounter[crMAGIC]=0; | |
| 20310 | 18 | temp_zinit.counter[crMAGIC]=0; | |
| 20311 | 18 | temp_zinit.magicdrainrate = 2; | |
| 20312 | 18 | } | |
| 20313 | |||
| 20314 |
5/6✓ Branch 0 taken 271 times.
✓ Branch 1 taken 18 times.
✓ Branch 2 taken 5 times.
✓ Branch 3 taken 266 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 5 times.
|
289 | if((Header->zelda_version < 0x192)||((Header->zelda_version == 0x192)&&(Header->build<129))) |
| 20315 | { | ||
| 20316 | |||
| 20317 |
2/2✓ Branch 0 taken 72 times.
✓ Branch 1 taken 18 times.
|
90 | for(int32_t x=0; x<4; x++) |
| 20318 | { | ||
| 20319 | 72 | beam_hearts[x]=100; | |
| 20320 | 72 | } | |
| 20321 | |||
| 20322 |
2/2✓ Branch 0 taken 72 times.
✓ Branch 1 taken 18 times.
|
90 | for(int32_t i=0; i<idBP_MAX; i++) |
| 20323 | { | ||
| 20324 | 72 | set_bit(&beam_percent,i,!get_qr(qr_LENSHINTS+i)); | |
| 20325 | 72 | set_qr(qr_LENSHINTS+i,0); | |
| 20326 | 72 | } | |
| 20327 | |||
| 20328 |
2/2✓ Branch 0 taken 72 times.
✓ Branch 1 taken 18 times.
|
90 | for(int32_t x=0; x<4; x++) |
| 20329 | { | ||
| 20330 | 72 | beam_power[x]=get_qr(qr_HIDECARRIEDITEMS)?50:100; | |
| 20331 | 72 | } | |
| 20332 | |||
| 20333 | 18 | set_qr(qr_HIDECARRIEDITEMS,0); | |
| 20334 | 18 | hookshot_links=100; | |
| 20335 | 18 | temp_zinit.msg_more_x=224; | |
| 20336 | 18 | temp_zinit.msg_more_y=64; | |
| 20337 | 18 | } | |
| 20338 | |||
| 20339 | // Okay, let's put these legacy values into itemsbuf. | ||
| 20340 |
2/2✓ Branch 0 taken 207 times.
✓ Branch 1 taken 82 times.
|
289 | if(s_version < 15) |
| 20341 |
2/2✓ Branch 0 taken 20992 times.
✓ Branch 1 taken 82 times.
|
21074 | for(int32_t i=0; i<MAXITEMS; i++) |
| 20342 | { | ||
| 20343 |
11/11✓ Branch 0 taken 82 times.
✓ Branch 1 taken 82 times.
✓ Branch 2 taken 82 times.
✓ Branch 3 taken 82 times.
✓ Branch 4 taken 82 times.
✓ Branch 5 taken 82 times.
✓ Branch 6 taken 82 times.
✓ Branch 7 taken 82 times.
✓ Branch 8 taken 20172 times.
✓ Branch 9 taken 82 times.
✓ Branch 10 taken 82 times.
|
20992 | switch(i) |
| 20344 | { | ||
| 20345 | case iFairyStill: | ||
| 20346 | 82 | itemsbuf[i].misc1 = stationary_fairy_hearts; | |
| 20347 | 82 | itemsbuf[i].misc2 = stationary_fairy_magic; | |
| 20348 | 82 | itemsbuf[i].misc3 = 0; | |
| 20349 | 82 | itemsbuf[i].flags |= stationary_fairy_heart_percent ? ITEM_FLAG1 : 0; | |
| 20350 | 82 | itemsbuf[i].flags |= stationary_fairy_magic_percent ? ITEM_FLAG2 : 0; | |
| 20351 | 82 | break; | |
| 20352 | |||
| 20353 | case iFairyMoving: | ||
| 20354 | 82 | itemsbuf[i].misc1 = moving_fairy_hearts; | |
| 20355 | 82 | itemsbuf[i].misc2 = moving_fairy_magic; | |
| 20356 | 82 | itemsbuf[i].misc3 = 50; | |
| 20357 | 82 | itemsbuf[i].flags |= moving_fairy_heart_percent ? ITEM_FLAG1 : 0; | |
| 20358 | 82 | itemsbuf[i].flags |= moving_fairy_magic_percent ? ITEM_FLAG2 : 0; | |
| 20359 | 82 | break; | |
| 20360 | |||
| 20361 | case iRPotion: | ||
| 20362 | 82 | itemsbuf[i].misc1 = red_potion_hearts; | |
| 20363 | 82 | itemsbuf[i].misc2 = red_potion_magic; | |
| 20364 | 82 | itemsbuf[i].flags |= red_potion_heart_percent ? ITEM_FLAG1 : 0; | |
| 20365 | 82 | itemsbuf[i].flags |= red_potion_magic_percent ? ITEM_FLAG2 : 0; | |
| 20366 | 82 | break; | |
| 20367 | |||
| 20368 | case iBPotion: | ||
| 20369 | 82 | itemsbuf[i].misc1 = blue_potion_hearts; | |
| 20370 | 82 | itemsbuf[i].misc2 = blue_potion_magic; | |
| 20371 | 82 | itemsbuf[i].flags |= blue_potion_heart_percent ? ITEM_FLAG1 : 0; | |
| 20372 | 82 | itemsbuf[i].flags |= blue_potion_magic_percent ? ITEM_FLAG2 : 0; | |
| 20373 | 82 | break; | |
| 20374 | |||
| 20375 | case iSword: | ||
| 20376 | 82 | itemsbuf[i].pickup_hearts = sword_hearts[0]; | |
| 20377 | 82 | itemsbuf[i].misc1 = beam_hearts[0]; | |
| 20378 | 82 | itemsbuf[i].misc2 = beam_power[0]; | |
| 20379 | // It seems that ITEM_FLAG1 was already added by reset_itembuf()... | ||
| 20380 | 82 | itemsbuf[i].flags &= (!get_bit(&beam_percent,0)) ? ~ITEM_FLAG1 : ~0; | |
| 20381 | 82 | break; | |
| 20382 | |||
| 20383 | case iWSword: | ||
| 20384 | 82 | itemsbuf[i].pickup_hearts = sword_hearts[1]; | |
| 20385 | 82 | itemsbuf[i].misc1 = beam_hearts[1]; | |
| 20386 | 82 | itemsbuf[i].misc2 = beam_power[1]; | |
| 20387 | 82 | itemsbuf[i].flags &= (!get_bit(&beam_percent,1)) ? ~ITEM_FLAG1 : ~0; | |
| 20388 | 82 | break; | |
| 20389 | |||
| 20390 | case iMSword: | ||
| 20391 | 82 | itemsbuf[i].pickup_hearts = sword_hearts[2]; | |
| 20392 | 82 | itemsbuf[i].misc1 = beam_hearts[2]; | |
| 20393 | 82 | itemsbuf[i].misc2 = beam_power[2]; | |
| 20394 | 82 | itemsbuf[i].flags &= (!get_bit(&beam_percent,2)) ? ~ITEM_FLAG1 : ~0; | |
| 20395 | 82 | break; | |
| 20396 | |||
| 20397 | case iXSword: | ||
| 20398 | 82 | itemsbuf[i].pickup_hearts = sword_hearts[3]; | |
| 20399 | 82 | itemsbuf[i].misc1 = beam_hearts[3]; | |
| 20400 | 82 | itemsbuf[i].misc2 = beam_power[3]; | |
| 20401 | 82 | itemsbuf[i].flags &= (!get_bit(&beam_percent,3)) ? ~ITEM_FLAG1 : ~0; | |
| 20402 | 82 | break; | |
| 20403 | |||
| 20404 | case iHookshot: | ||
| 20405 | 82 | itemsbuf[i].misc1 = hookshot_length; | |
| 20406 | 82 | itemsbuf[i].misc2 = hookshot_links; | |
| 20407 | 82 | break; | |
| 20408 | |||
| 20409 | case iLongshot: | ||
| 20410 | 82 | itemsbuf[i].misc1 = longshot_length; | |
| 20411 | 82 | itemsbuf[i].misc2 = longshot_links; | |
| 20412 | 82 | break; | |
| 20413 | } | ||
| 20414 | 21074 | } | |
| 20415 | |||
| 20416 |
6/6✓ Branch 0 taken 271 times.
✓ Branch 1 taken 18 times.
✓ Branch 2 taken 5 times.
✓ Branch 3 taken 266 times.
✓ Branch 4 taken 4 times.
✓ Branch 5 taken 1 times.
|
289 | if((Header->zelda_version < 0x192)||((Header->zelda_version == 0x192)&&(Header->build<168))) |
| 20417 | { | ||
| 20418 | //was new subscreen rule | ||
| 20419 | 22 | subscr_mode=get_qr(qr_FREEFORM)?1:0; | |
| 20420 | 22 | set_qr(qr_FREEFORM,0); | |
| 20421 | 22 | } | |
| 20422 | |||
| 20423 |
5/6✓ Branch 0 taken 271 times.
✓ Branch 1 taken 18 times.
✓ Branch 2 taken 5 times.
✓ Branch 3 taken 266 times.
✓ Branch 4 taken 5 times.
✗ Branch 5 not taken.
|
289 | if((Header->zelda_version < 0x192)||((Header->zelda_version == 0x192)&&(Header->build<185))) |
| 20424 | { | ||
| 20425 | 23 | temp_zinit.start_dmap=0; | |
| 20426 | 23 | } | |
| 20427 | |||
| 20428 |
5/6✓ Branch 0 taken 271 times.
✓ Branch 1 taken 18 times.
✓ Branch 2 taken 5 times.
✓ Branch 3 taken 266 times.
✓ Branch 4 taken 5 times.
✗ Branch 5 not taken.
|
289 | if((Header->zelda_version < 0x192)||((Header->zelda_version == 0x192)&&(Header->build<186))) |
| 20429 | { | ||
| 20430 | 23 | temp_zinit.heroAnimationStyle=get_qr(qr_BSZELDA)?1:0; | |
| 20431 | 23 | } | |
| 20432 | |||
| 20433 |
3/4✓ Branch 0 taken 82 times.
✓ Branch 1 taken 207 times.
✓ Branch 2 taken 82 times.
✗ Branch 3 not taken.
|
289 | if(s_version < 16 && get_bit(deprecated_rules, qr_COOLSCROLL+1)) |
| 20434 | { | ||
| 20435 | //addOldStyleFamily(&temp_zinit, itemsbuf, itype_wallet, 4); //is this needed? | ||
| 20436 | ✗ | temp_zinit.mcounter[crMONEY]=999; | |
| 20437 | //temp_zinit.counter[crMONEY]=999; //This rule only gave you an invisible max wallet; it did not give you max rupies. | ||
| 20438 | ✗ | } | |
| 20439 |
2/2✓ Branch 0 taken 283 times.
✓ Branch 1 taken 6 times.
|
289 | if(Header->zelda_version < 0x190) //1.84 bugfix. -Z |
| 20440 | { | ||
| 20441 | //temp_zinit.items[iBombBag] = true; //No, this is 30 max bombs! | ||
| 20442 | 6 | temp_zinit.mcounter[crBOMBS] = 8; | |
| 20443 | 6 | } | |
| 20444 | // al_trace("About to copy over new init data values for quest made in: %x\n", Header->zelda_version); | ||
| 20445 | //time to ensure that we port all new values properly: | ||
| 20446 |
2/2✓ Branch 0 taken 207 times.
✓ Branch 1 taken 82 times.
|
289 | if(Header->zelda_version < 0x250) |
| 20447 | { | ||
| 20448 |
1/2✓ Branch 0 taken 82 times.
✗ Branch 1 not taken.
|
82 | temp_zinit.mcounter[crSBOMBS] = bomb_ratio > 0 ? ( temp_zinit.mcounter[crBOMBS]/temp_zinit.bomb_ratio ) : (temp_zinit.mcounter[crBOMBS]/4); |
| 20449 | 82 | } | |
| 20450 | |||
| 20451 |
2/2✓ Branch 0 taken 18 times.
✓ Branch 1 taken 271 times.
|
289 | if(s_version > 21) |
| 20452 | { | ||
| 20453 |
1/2✓ Branch 0 taken 18 times.
✗ Branch 1 not taken.
|
18 | if(!p_getc(&temp_zinit.hp_per_heart,f)) |
| 20454 | { | ||
| 20455 | ✗ | return qe_invalid; | |
| 20456 | } | ||
| 20457 |
1/2✓ Branch 0 taken 18 times.
✗ Branch 1 not taken.
|
18 | if(!p_getc(&temp_zinit.magic_per_block,f)) |
| 20458 | { | ||
| 20459 | ✗ | return qe_invalid; | |
| 20460 | } | ||
| 20461 |
1/2✓ Branch 0 taken 18 times.
✗ Branch 1 not taken.
|
18 | if(!p_getc(&temp_zinit.hero_damage_multiplier,f)) |
| 20462 | { | ||
| 20463 | ✗ | return qe_invalid; | |
| 20464 | } | ||
| 20465 |
1/2✓ Branch 0 taken 18 times.
✗ Branch 1 not taken.
|
18 | if(!p_getc(&temp_zinit.ene_damage_multiplier,f)) |
| 20466 | { | ||
| 20467 | ✗ | return qe_invalid; | |
| 20468 | } | ||
| 20469 | 18 | } | |
| 20470 | else | ||
| 20471 | { | ||
| 20472 | 271 | temp_zinit.hp_per_heart = 16; //HP_PER_HEART, previously hardcoded | |
| 20473 | 271 | temp_zinit.magic_per_block = 32; //MAGICPERBLOCK, previously hardcoded | |
| 20474 | 271 | temp_zinit.hero_damage_multiplier = 2; //DAMAGE_MULTIPLIER, previously hardcoded | |
| 20475 | 271 | temp_zinit.ene_damage_multiplier = 4; //(HP_PER_HEART/4), previously hardcoded | |
| 20476 | } | ||
| 20477 | |||
| 20478 |
2/2✓ Branch 0 taken 271 times.
✓ Branch 1 taken 18 times.
|
289 | if(s_version > 22) |
| 20479 | { | ||
| 20480 |
2/2✓ Branch 0 taken 450 times.
✓ Branch 1 taken 18 times.
|
468 | for(int32_t q = crCUSTOM1; q <= crCUSTOM25; ++q) |
| 20481 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 450 times.
|
450 | if(!p_igetw(&temp_zinit.counter[q],f)) |
| 20482 | ✗ | return qe_invalid; | |
| 20483 |
2/2✓ Branch 0 taken 450 times.
✓ Branch 1 taken 18 times.
|
468 | for(int32_t q = crCUSTOM1; q <= crCUSTOM25; ++q) |
| 20484 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 450 times.
|
450 | if(!p_igetw(&temp_zinit.mcounter[q],f)) |
| 20485 | ✗ | return qe_invalid; | |
| 20486 | 18 | } | |
| 20487 | |||
| 20488 | |||
| 20489 |
2/2✓ Branch 0 taken 18 times.
✓ Branch 1 taken 271 times.
|
289 | if(s_version > 23) |
| 20490 | { | ||
| 20491 |
1/2✓ Branch 0 taken 18 times.
✗ Branch 1 not taken.
|
18 | if(!p_getc(&temp_zinit.dither_type,f)) |
| 20492 | { | ||
| 20493 | ✗ | return qe_invalid; | |
| 20494 | } | ||
| 20495 |
1/2✓ Branch 0 taken 18 times.
✗ Branch 1 not taken.
|
18 | if(!p_getc(&temp_zinit.dither_arg,f)) |
| 20496 | { | ||
| 20497 | ✗ | return qe_invalid; | |
| 20498 | } | ||
| 20499 |
1/2✓ Branch 0 taken 18 times.
✗ Branch 1 not taken.
|
18 | if(!p_getc(&temp_zinit.dither_percent,f)) |
| 20500 | { | ||
| 20501 | ✗ | return qe_invalid; | |
| 20502 | } | ||
| 20503 |
1/2✓ Branch 0 taken 18 times.
✗ Branch 1 not taken.
|
18 | if(!p_getc(&temp_zinit.def_lightrad,f)) |
| 20504 | { | ||
| 20505 | ✗ | return qe_invalid; | |
| 20506 | } | ||
| 20507 |
1/2✓ Branch 0 taken 18 times.
✗ Branch 1 not taken.
|
18 | if(!p_getc(&temp_zinit.transdark_percent,f)) |
| 20508 | { | ||
| 20509 | ✗ | return qe_invalid; | |
| 20510 | } | ||
| 20511 | 18 | } | |
| 20512 | else | ||
| 20513 | { | ||
| 20514 | 271 | temp_zinit.dither_type = 0; | |
| 20515 | 271 | temp_zinit.dither_arg = 0; | |
| 20516 | 271 | temp_zinit.dither_percent = 20; | |
| 20517 | 271 | temp_zinit.def_lightrad = 24; | |
| 20518 | 271 | temp_zinit.transdark_percent = 0; | |
| 20519 | } | ||
| 20520 | |||
| 20521 |
2/2✓ Branch 0 taken 18 times.
✓ Branch 1 taken 271 times.
|
289 | if(s_version > 24) |
| 20522 | { | ||
| 20523 |
1/2✓ Branch 0 taken 18 times.
✗ Branch 1 not taken.
|
18 | if(!p_getc(&temp_zinit.darkcol,f)) |
| 20524 | { | ||
| 20525 | ✗ | return qe_invalid; | |
| 20526 | } | ||
| 20527 | 18 | } | |
| 20528 | else | ||
| 20529 | { | ||
| 20530 | 271 | temp_zinit.darkcol = BLACK; | |
| 20531 | } | ||
| 20532 | |||
| 20533 |
2/2✓ Branch 0 taken 271 times.
✓ Branch 1 taken 18 times.
|
289 | if(s_version > 25) |
| 20534 | { | ||
| 20535 |
1/2✓ Branch 0 taken 18 times.
✗ Branch 1 not taken.
|
18 | if(!p_igetl(&temp_zinit.gravity,f)) |
| 20536 | { | ||
| 20537 | ✗ | return qe_invalid; | |
| 20538 | } | ||
| 20539 |
1/2✓ Branch 0 taken 18 times.
✗ Branch 1 not taken.
|
18 | if(!p_igetl(&temp_zinit.swimgravity,f)) |
| 20540 | { | ||
| 20541 | ✗ | return qe_invalid; | |
| 20542 | } | ||
| 20543 | 18 | } | |
| 20544 | |||
| 20545 | |||
| 20546 |
2/2✓ Branch 0 taken 18 times.
✓ Branch 1 taken 271 times.
|
289 | if(s_version > 26) |
| 20547 | { | ||
| 20548 |
1/2✓ Branch 0 taken 18 times.
✗ Branch 1 not taken.
|
18 | if(!p_igetw(&temp_zinit.heroSideswimUpStep,f)) |
| 20549 | { | ||
| 20550 | ✗ | return qe_invalid; | |
| 20551 | } | ||
| 20552 |
1/2✓ Branch 0 taken 18 times.
✗ Branch 1 not taken.
|
18 | if(!p_igetw(&temp_zinit.heroSideswimSideStep,f)) |
| 20553 | { | ||
| 20554 | ✗ | return qe_invalid; | |
| 20555 | } | ||
| 20556 |
1/2✓ Branch 0 taken 18 times.
✗ Branch 1 not taken.
|
18 | if(!p_igetw(&temp_zinit.heroSideswimDownStep,f)) |
| 20557 | { | ||
| 20558 | ✗ | return qe_invalid; | |
| 20559 | } | ||
| 20560 | 18 | } | |
| 20561 | else | ||
| 20562 | { | ||
| 20563 | 271 | temp_zinit.heroSideswimUpStep = 150; | |
| 20564 | 271 | temp_zinit.heroSideswimSideStep = 100; | |
| 20565 | 271 | temp_zinit.heroSideswimDownStep = 75; | |
| 20566 | } | ||
| 20567 | |||
| 20568 |
2/2✓ Branch 0 taken 18 times.
✓ Branch 1 taken 271 times.
|
289 | if(s_version > 27) |
| 20569 | { | ||
| 20570 |
1/2✓ Branch 0 taken 18 times.
✗ Branch 1 not taken.
|
18 | if(!p_igetl(&temp_zinit.exitWaterJump,f)) |
| 20571 | { | ||
| 20572 | ✗ | return qe_invalid; | |
| 20573 | } | ||
| 20574 | 18 | } | |
| 20575 | else | ||
| 20576 | { | ||
| 20577 | 271 | temp_zinit.exitWaterJump = 0; | |
| 20578 | } | ||
| 20579 | |||
| 20580 |
2/2✓ Branch 0 taken 18 times.
✓ Branch 1 taken 271 times.
|
289 | if(s_version > 29) |
| 20581 | { | ||
| 20582 |
1/2✓ Branch 0 taken 18 times.
✗ Branch 1 not taken.
|
18 | if(!p_igetl(&temp_zinit.bunny_ltm,f)) |
| 20583 | { | ||
| 20584 | ✗ | return qe_invalid; | |
| 20585 | } | ||
| 20586 | 18 | } | |
| 20587 | else | ||
| 20588 | { | ||
| 20589 | 271 | temp_zinit.bunny_ltm = 0; | |
| 20590 | } | ||
| 20591 | |||
| 20592 |
2/2✓ Branch 0 taken 18 times.
✓ Branch 1 taken 271 times.
|
289 | if(s_version > 30) |
| 20593 | { | ||
| 20594 |
1/2✓ Branch 0 taken 18 times.
✗ Branch 1 not taken.
|
18 | if(!p_getc(&temp_zinit.switchhookstyle,f)) |
| 20595 | { | ||
| 20596 | ✗ | return qe_invalid; | |
| 20597 | } | ||
| 20598 | 18 | } | |
| 20599 | else | ||
| 20600 | { | ||
| 20601 | 271 | temp_zinit.switchhookstyle = 1; | |
| 20602 | } | ||
| 20603 | |||
| 20604 |
2/2✓ Branch 0 taken 271 times.
✓ Branch 1 taken 18 times.
|
289 | if(s_version > 31) |
| 20605 | { | ||
| 20606 |
1/2✓ Branch 0 taken 18 times.
✗ Branch 1 not taken.
|
18 | if(!p_getc(&temp_zinit.magicdrainrate,f)) |
| 20607 | { | ||
| 20608 | ✗ | return qe_invalid; | |
| 20609 | } | ||
| 20610 | 18 | } | |
| 20611 | |||
| 20612 | 289 | temp_zinit.clear_genscript(); | |
| 20613 |
2/2✓ Branch 0 taken 276 times.
✓ Branch 1 taken 13 times.
|
289 | if(s_version > 32) |
| 20614 | { | ||
| 20615 | 13 | word numgenscript = 0; | |
| 20616 |
1/2✓ Branch 0 taken 13 times.
✗ Branch 1 not taken.
|
13 | if(!p_igetw(&numgenscript,f)) |
| 20617 | ✗ | return qe_invalid; | |
| 20618 |
2/4✓ Branch 0 taken 13 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 13 times.
|
13 | if (!(numgenscript >= 0 && numgenscript <= NUMSCRIPTSGENERIC)) |
| 20619 | ✗ | return qe_invalid; | |
| 20620 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 13 times.
|
13 | for(auto q = 1; q < numgenscript; ++q) |
| 20621 | { | ||
| 20622 | ✗ | if(!p_getc(&tempbyte,f)) | |
| 20623 | ✗ | return qe_invalid; | |
| 20624 | ✗ | if(!(tempbyte&2)) | |
| 20625 | ✗ | continue; | |
| 20626 | ✗ | temp_zinit.gen_doscript.set(q, tempbyte&1); | |
| 20627 | ✗ | if(!p_igetw(&temp_zinit.gen_exitState[q],f)) | |
| 20628 | ✗ | return qe_invalid; | |
| 20629 | ✗ | if(!p_igetw(&temp_zinit.gen_reloadState[q],f)) | |
| 20630 | ✗ | return qe_invalid; | |
| 20631 | ✗ | for(auto p = 0; p < 8; ++p) | |
| 20632 | ✗ | if(!p_igetl(&temp_zinit.gen_initd[q][p],f)) | |
| 20633 | ✗ | return qe_invalid; | |
| 20634 | dword sz; | ||
| 20635 | ✗ | if(!p_igetl(&sz,f)) | |
| 20636 | ✗ | return qe_invalid; | |
| 20637 | ✗ | temp_zinit.gen_data[q].resize(sz); | |
| 20638 | ✗ | std::vector<int32_t> dummy; | |
| 20639 | ✗ | if(!p_getlvec(&dummy,f)) | |
| 20640 | ✗ | return qe_invalid; | |
| 20641 | ✗ | temp_zinit.gen_data[q] = dummy; | |
| 20642 | ✗ | if(!p_igetl(&temp_zinit.gen_eventstate[q],f)) | |
| 20643 | ✗ | return qe_invalid; | |
| 20644 | ✗ | } | |
| 20645 | 13 | } | |
| 20646 |
2/2✓ Branch 0 taken 282 times.
✓ Branch 1 taken 7 times.
|
289 | if(s_version > 33) |
| 20647 | { | ||
| 20648 |
1/2✓ Branch 0 taken 7 times.
✗ Branch 1 not taken.
|
7 | if(!p_getc(&temp_zinit.hero_swim_mult,f)) |
| 20649 | ✗ | return qe_invalid; | |
| 20650 |
1/2✓ Branch 0 taken 7 times.
✗ Branch 1 not taken.
|
7 | if(!p_getc(&temp_zinit.hero_swim_div,f)) |
| 20651 | ✗ | return qe_invalid; | |
| 20652 | 7 | } | |
| 20653 |
1/2✓ Branch 0 taken 289 times.
✗ Branch 1 not taken.
|
289 | if(s_version > 34) |
| 20654 | { | ||
| 20655 | uint32_t num_used_mapscr_data; | ||
| 20656 | ✗ | if(!p_igetl(&num_used_mapscr_data,f)) | |
| 20657 | ✗ | return qe_invalid; | |
| 20658 | ✗ | for(uint32_t q = 0; q < num_used_mapscr_data; ++q) | |
| 20659 | { | ||
| 20660 | uint32_t sz; | ||
| 20661 | ✗ | if(!p_igetl(&sz,f)) | |
| 20662 | ✗ | return qe_invalid; | |
| 20663 | ✗ | temp_zinit.screen_data[q].resize(sz); | |
| 20664 | ✗ | if(sz) | |
| 20665 | { | ||
| 20666 | ✗ | std::vector<int32_t> dummy; | |
| 20667 | ✗ | if(!p_getlvec(&dummy,f)) | |
| 20668 | ✗ | return qe_invalid; | |
| 20669 | ✗ | temp_zinit.screen_data[q] = dummy; | |
| 20670 | ✗ | } | |
| 20671 | ✗ | } | |
| 20672 | ✗ | } | |
| 20673 |
1/2✓ Branch 0 taken 289 times.
✗ Branch 1 not taken.
|
289 | if (s_version > 35) |
| 20674 | ✗ | if(!p_igetzf(&temp_zinit.shove_offset,f)) | |
| 20675 | ✗ | return qe_invalid; | |
| 20676 | |||
| 20677 | 289 | temp_zinit.counter[crLIFE] *= temp_zinit.hp_per_heart; | |
| 20678 | 289 | temp_zinit.mcounter[crLIFE] *= temp_zinit.hp_per_heart; | |
| 20679 |
2/2✓ Branch 0 taken 188 times.
✓ Branch 1 taken 101 times.
|
289 | if(!temp_zinit.flags.get(INIT_FL_CONTPERCENT)) |
| 20680 | 101 | temp_zinit.cont_heart *= temp_zinit.hp_per_heart; | |
| 20681 | |||
| 20682 | 289 | return 0; | |
| 20683 | 289 | } | |
| 20684 | 694 | int32_t readinitdata(PACKFILE *f, zquestheader *Header) | |
| 20685 | { | ||
| 20686 | 694 | zinitdata temp_zinit = {}; | |
| 20687 | |||
| 20688 |
3/4✓ Branch 0 taken 671 times.
✓ Branch 1 taken 23 times.
✓ Branch 2 taken 23 times.
✗ Branch 3 not taken.
|
694 | bool should_skip = legacy_skip_flags && get_bit(legacy_skip_flags, skip_initdata); |
| 20689 | |||
| 20690 | int32_t dummy; | ||
| 20691 | 694 | word s_version=0, s_cversion=0; | |
| 20692 | byte padding; | ||
| 20693 | |||
| 20694 |
2/2✓ Branch 0 taken 671 times.
✓ Branch 1 taken 23 times.
|
694 | if(Header->zelda_version > 0x192) |
| 20695 | { | ||
| 20696 |
2/4✓ Branch 0 taken 671 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 671 times.
✗ Branch 3 not taken.
|
671 | if(!p_igetw(&s_version,f)) |
| 20697 | ✗ | return qe_invalid; | |
| 20698 | 671 | FFCore.quest_format[vInitData] = s_version; | |
| 20699 | |||
| 20700 |
2/4✓ Branch 0 taken 671 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 671 times.
✗ Branch 3 not taken.
|
671 | if(!p_igetw(&s_cversion,f)) |
| 20701 | ✗ | return qe_invalid; | |
| 20702 | |||
| 20703 | //section size | ||
| 20704 |
2/4✓ Branch 0 taken 671 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 671 times.
✗ Branch 3 not taken.
|
671 | if(!p_igetl(&dummy,f)) |
| 20705 | ✗ | return qe_invalid; | |
| 20706 | 671 | } | |
| 20707 | |||
| 20708 |
2/2✓ Branch 0 taken 289 times.
✓ Branch 1 taken 405 times.
|
694 | if(s_version < 37) |
| 20709 | { | ||
| 20710 |
2/4✓ Branch 0 taken 289 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 289 times.
|
289 | if(auto ret = readinitdata_old(f,Header,s_version,s_cversion,temp_zinit)) |
| 20711 | ✗ | return ret; | |
| 20712 | 289 | } | |
| 20713 | else | ||
| 20714 | { | ||
| 20715 | 405 | subscr_mode = ssdtMAX; | |
| 20716 |
2/2✓ Branch 0 taken 12960 times.
✓ Branch 1 taken 405 times.
|
13365 | for(int q = 0; q < MAXITEMS/8; ++q) |
| 20717 |
2/4✓ Branch 0 taken 12960 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 12960 times.
|
12960 | if(!p_getc(&temp_zinit.items[q], f)) |
| 20718 | ✗ | return qe_invalid; | |
| 20719 |
2/2✓ Branch 0 taken 405 times.
✓ Branch 1 taken 25920 times.
|
26325 | for(int q = 0; q < MAXLEVELS/8; ++q) |
| 20720 | { | ||
| 20721 |
2/4✓ Branch 0 taken 25920 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 25920 times.
✗ Branch 3 not taken.
|
25920 | if(!p_getc(&temp_zinit.map[q], f)) |
| 20722 | ✗ | return qe_invalid; | |
| 20723 |
2/4✓ Branch 0 taken 25920 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 25920 times.
|
25920 | if(!p_getc(&temp_zinit.compass[q], f)) |
| 20724 | ✗ | return qe_invalid; | |
| 20725 |
2/4✓ Branch 0 taken 25920 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 25920 times.
|
25920 | if(!p_getc(&temp_zinit.boss_key[q], f)) |
| 20726 | ✗ | return qe_invalid; | |
| 20727 |
2/4✓ Branch 0 taken 25920 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 25920 times.
✗ Branch 3 not taken.
|
25920 | if(!p_getc(&temp_zinit.mcguffin[q], f)) |
| 20728 | ✗ | return qe_invalid; | |
| 20729 | 25920 | } | |
| 20730 |
2/4✓ Branch 0 taken 405 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 405 times.
✗ Branch 3 not taken.
|
405 | if(!p_getbvec(&temp_zinit.level_keys, f)) |
| 20731 | ✗ | return qe_invalid; | |
| 20732 | byte num_counters; | ||
| 20733 |
2/4✓ Branch 0 taken 405 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 405 times.
✗ Branch 3 not taken.
|
405 | if(!p_getc(&num_counters,f)) |
| 20734 | ✗ | return qe_invalid; | |
| 20735 |
2/2✓ Branch 0 taken 43335 times.
✓ Branch 1 taken 405 times.
|
43740 | for(int q = 0; q < num_counters; ++q) |
| 20736 |
2/4✓ Branch 0 taken 43335 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 43335 times.
|
43335 | if(!p_igetw(&temp_zinit.counter[q],f)) |
| 20737 | ✗ | return qe_invalid; | |
| 20738 |
2/2✓ Branch 0 taken 405 times.
✓ Branch 1 taken 43335 times.
|
43740 | for(int q = 0; q < num_counters; ++q) |
| 20739 |
2/4✓ Branch 0 taken 43335 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 43335 times.
|
43335 | if(!p_igetw(&temp_zinit.mcounter[q],f)) |
| 20740 | ✗ | return qe_invalid; | |
| 20741 |
2/4✓ Branch 0 taken 405 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 405 times.
✗ Branch 3 not taken.
|
405 | if(!p_getc(&temp_zinit.bomb_ratio,f)) |
| 20742 | ✗ | return qe_invalid; | |
| 20743 |
2/4✓ Branch 0 taken 405 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 405 times.
✗ Branch 3 not taken.
|
405 | if(!p_getc(&temp_zinit.hcp,f)) |
| 20744 | ✗ | return qe_invalid; | |
| 20745 |
2/4✓ Branch 0 taken 405 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 405 times.
✗ Branch 3 not taken.
|
405 | if(!p_getc(&temp_zinit.hcp_per_hc,f)) |
| 20746 | ✗ | return qe_invalid; | |
| 20747 |
2/4✓ Branch 0 taken 405 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 405 times.
✗ Branch 3 not taken.
|
405 | if(!p_igetw(&temp_zinit.cont_heart,f)) |
| 20748 | ✗ | return qe_invalid; | |
| 20749 |
2/4✓ Branch 0 taken 405 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 405 times.
✗ Branch 3 not taken.
|
405 | if(!p_getc(&temp_zinit.hp_per_heart,f)) |
| 20750 | ✗ | return qe_invalid; | |
| 20751 |
2/4✓ Branch 0 taken 405 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 405 times.
✗ Branch 3 not taken.
|
405 | if(!p_getc(&temp_zinit.magic_per_block,f)) |
| 20752 | ✗ | return qe_invalid; | |
| 20753 |
2/4✓ Branch 0 taken 405 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 405 times.
✗ Branch 3 not taken.
|
405 | if(!p_getc(&temp_zinit.hero_damage_multiplier,f)) |
| 20754 | ✗ | return qe_invalid; | |
| 20755 |
2/4✓ Branch 0 taken 405 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 405 times.
✗ Branch 3 not taken.
|
405 | if(!p_getc(&temp_zinit.ene_damage_multiplier,f)) |
| 20756 | ✗ | return qe_invalid; | |
| 20757 |
2/4✓ Branch 0 taken 405 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 405 times.
✗ Branch 3 not taken.
|
405 | if(!p_getc(&temp_zinit.dither_type,f)) |
| 20758 | ✗ | return qe_invalid; | |
| 20759 |
2/4✓ Branch 0 taken 405 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 405 times.
✗ Branch 3 not taken.
|
405 | if(!p_getc(&temp_zinit.dither_arg,f)) |
| 20760 | ✗ | return qe_invalid; | |
| 20761 |
2/4✓ Branch 0 taken 405 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 405 times.
✗ Branch 3 not taken.
|
405 | if(!p_getc(&temp_zinit.dither_percent,f)) |
| 20762 | ✗ | return qe_invalid; | |
| 20763 |
2/4✓ Branch 0 taken 405 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 405 times.
✗ Branch 3 not taken.
|
405 | if(!p_getc(&temp_zinit.def_lightrad,f)) |
| 20764 | ✗ | return qe_invalid; | |
| 20765 |
2/4✓ Branch 0 taken 405 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 405 times.
✗ Branch 3 not taken.
|
405 | if(!p_getc(&temp_zinit.transdark_percent,f)) |
| 20766 | ✗ | return qe_invalid; | |
| 20767 |
2/4✓ Branch 0 taken 405 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 405 times.
✗ Branch 3 not taken.
|
405 | if(!p_getc(&temp_zinit.darkcol,f)) |
| 20768 | ✗ | return qe_invalid; | |
| 20769 |
2/4✓ Branch 0 taken 405 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 405 times.
✗ Branch 3 not taken.
|
405 | if(!p_igetl(&temp_zinit.ss_grid_x,f)) |
| 20770 | ✗ | return qe_invalid; | |
| 20771 |
2/4✓ Branch 0 taken 405 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 405 times.
✗ Branch 3 not taken.
|
405 | if(!p_igetl(&temp_zinit.ss_grid_y,f)) |
| 20772 | ✗ | return qe_invalid; | |
| 20773 |
2/4✓ Branch 0 taken 405 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 405 times.
✗ Branch 3 not taken.
|
405 | if(!p_igetl(&temp_zinit.ss_grid_xofs,f)) |
| 20774 | ✗ | return qe_invalid; | |
| 20775 |
2/4✓ Branch 0 taken 405 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 405 times.
✗ Branch 3 not taken.
|
405 | if(!p_igetl(&temp_zinit.ss_grid_yofs,f)) |
| 20776 | ✗ | return qe_invalid; | |
| 20777 |
2/4✓ Branch 0 taken 405 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 405 times.
✗ Branch 3 not taken.
|
405 | if(!p_igetl(&temp_zinit.ss_grid_color,f)) |
| 20778 | ✗ | return qe_invalid; | |
| 20779 |
2/4✓ Branch 0 taken 405 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 405 times.
✗ Branch 3 not taken.
|
405 | if(!p_igetl(&temp_zinit.ss_bbox_1_color,f)) |
| 20780 | ✗ | return qe_invalid; | |
| 20781 |
2/4✓ Branch 0 taken 405 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 405 times.
✗ Branch 3 not taken.
|
405 | if(!p_igetl(&temp_zinit.ss_bbox_2_color,f)) |
| 20782 | ✗ | return qe_invalid; | |
| 20783 |
2/4✓ Branch 0 taken 405 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 405 times.
✗ Branch 3 not taken.
|
405 | if(!p_igetl(&temp_zinit.ss_flags,f)) |
| 20784 | ✗ | return qe_invalid; | |
| 20785 |
2/4✓ Branch 0 taken 405 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 405 times.
✗ Branch 3 not taken.
|
405 | if(!p_getbitstr(&temp_zinit.flags,f)) |
| 20786 | ✗ | return qe_invalid; | |
| 20787 |
2/4✓ Branch 0 taken 405 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 405 times.
✗ Branch 3 not taken.
|
405 | if(!p_getc(&temp_zinit.last_map,f)) |
| 20788 | ✗ | return qe_invalid; | |
| 20789 |
2/4✓ Branch 0 taken 405 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 405 times.
✗ Branch 3 not taken.
|
405 | if(!p_getc(&temp_zinit.last_screen,f)) |
| 20790 | ✗ | return qe_invalid; | |
| 20791 |
2/4✓ Branch 0 taken 405 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 405 times.
✗ Branch 3 not taken.
|
405 | if(!p_getc(&temp_zinit.msg_more_x,f)) |
| 20792 | ✗ | return qe_invalid; | |
| 20793 |
2/4✓ Branch 0 taken 405 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 405 times.
✗ Branch 3 not taken.
|
405 | if(!p_getc(&temp_zinit.msg_more_y,f)) |
| 20794 | ✗ | return qe_invalid; | |
| 20795 |
2/4✓ Branch 0 taken 405 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 405 times.
✗ Branch 3 not taken.
|
405 | if(!p_getc(&temp_zinit.msg_more_is_offset,f)) |
| 20796 | ✗ | return qe_invalid; | |
| 20797 |
2/4✓ Branch 0 taken 405 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 405 times.
✗ Branch 3 not taken.
|
405 | if(!p_getc(&temp_zinit.msg_speed,f)) |
| 20798 | ✗ | return qe_invalid; | |
| 20799 |
2/4✓ Branch 0 taken 405 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 405 times.
✗ Branch 3 not taken.
|
405 | if(!p_igetl(&temp_zinit.gravity,f)) |
| 20800 | ✗ | return qe_invalid; | |
| 20801 |
2/4✓ Branch 0 taken 405 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 405 times.
✗ Branch 3 not taken.
|
405 | if(!p_igetl(&temp_zinit.swimgravity,f)) |
| 20802 | ✗ | return qe_invalid; | |
| 20803 |
2/4✓ Branch 0 taken 405 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 405 times.
✗ Branch 3 not taken.
|
405 | if(!p_igetw(&temp_zinit.terminalv,f)) |
| 20804 | ✗ | return qe_invalid; | |
| 20805 |
2/4✓ Branch 0 taken 405 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 405 times.
✗ Branch 3 not taken.
|
405 | if(!p_getc(&temp_zinit.hero_swim_speed,f)) |
| 20806 | ✗ | return qe_invalid; | |
| 20807 |
2/4✓ Branch 0 taken 405 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 405 times.
✗ Branch 3 not taken.
|
405 | if(!p_getc(&temp_zinit.hero_swim_mult,f)) |
| 20808 | ✗ | return qe_invalid; | |
| 20809 |
2/4✓ Branch 0 taken 405 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 405 times.
✗ Branch 3 not taken.
|
405 | if(!p_getc(&temp_zinit.hero_swim_div,f)) |
| 20810 | ✗ | return qe_invalid; | |
| 20811 |
2/4✓ Branch 0 taken 405 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 405 times.
✗ Branch 3 not taken.
|
405 | if(!p_igetw(&temp_zinit.heroSideswimUpStep,f)) |
| 20812 | ✗ | return qe_invalid; | |
| 20813 |
2/4✓ Branch 0 taken 405 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 405 times.
✗ Branch 3 not taken.
|
405 | if(!p_igetw(&temp_zinit.heroSideswimSideStep,f)) |
| 20814 | ✗ | return qe_invalid; | |
| 20815 |
2/4✓ Branch 0 taken 405 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 405 times.
✗ Branch 3 not taken.
|
405 | if(!p_igetw(&temp_zinit.heroSideswimDownStep,f)) |
| 20816 | ✗ | return qe_invalid; | |
| 20817 |
2/4✓ Branch 0 taken 405 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 405 times.
✗ Branch 3 not taken.
|
405 | if(!p_igetl(&temp_zinit.exitWaterJump,f)) |
| 20818 | ✗ | return qe_invalid; | |
| 20819 |
2/4✓ Branch 0 taken 405 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 405 times.
✗ Branch 3 not taken.
|
405 | if(!p_igetw(&temp_zinit.heroStep,f)) |
| 20820 | ✗ | return qe_invalid; | |
| 20821 |
2/4✓ Branch 0 taken 405 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 405 times.
✗ Branch 3 not taken.
|
405 | if(!p_getc(&temp_zinit.heroAnimationStyle,f)) |
| 20822 | ✗ | return qe_invalid; | |
| 20823 |
2/4✓ Branch 0 taken 405 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 405 times.
✗ Branch 3 not taken.
|
405 | if(!p_getc(&temp_zinit.jump_hero_layer_threshold,f)) |
| 20824 | ✗ | return qe_invalid; | |
| 20825 |
2/4✓ Branch 0 taken 405 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 405 times.
✗ Branch 3 not taken.
|
405 | if(!p_igetl(&temp_zinit.bunny_ltm,f)) |
| 20826 | ✗ | return qe_invalid; | |
| 20827 |
2/4✓ Branch 0 taken 405 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 405 times.
✗ Branch 3 not taken.
|
405 | if(!p_igetw(&temp_zinit.start_dmap,f)) |
| 20828 | ✗ | return qe_invalid; | |
| 20829 |
2/4✓ Branch 0 taken 405 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 405 times.
✗ Branch 3 not taken.
|
405 | if(!p_igetw(&temp_zinit.subscrSpeed,f)) |
| 20830 | ✗ | return qe_invalid; | |
| 20831 |
2/4✓ Branch 0 taken 405 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 405 times.
✗ Branch 3 not taken.
|
405 | if(!p_getc(&temp_zinit.switchhookstyle,f)) |
| 20832 | ✗ | return qe_invalid; | |
| 20833 |
2/4✓ Branch 0 taken 405 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 405 times.
✗ Branch 3 not taken.
|
405 | if(!p_getc(&temp_zinit.magicdrainrate,f)) |
| 20834 | ✗ | return qe_invalid; | |
| 20835 |
2/4✓ Branch 0 taken 405 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 405 times.
✗ Branch 3 not taken.
|
405 | if(!p_igetzf(&temp_zinit.shove_offset,f)) |
| 20836 | ✗ | return qe_invalid; | |
| 20837 |
2/4✓ Branch 0 taken 405 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 405 times.
✗ Branch 3 not taken.
|
405 | if(!p_getbitstr(&temp_zinit.gen_doscript, f)) |
| 20838 | ✗ | return qe_invalid; | |
| 20839 |
2/4✓ Branch 0 taken 405 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 405 times.
✗ Branch 3 not taken.
|
405 | if(!p_getbmap(&temp_zinit.gen_exitState, f)) |
| 20840 | ✗ | return qe_invalid; | |
| 20841 |
2/4✓ Branch 0 taken 405 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 405 times.
✗ Branch 3 not taken.
|
405 | if(!p_getbmap(&temp_zinit.gen_reloadState, f)) |
| 20842 | ✗ | return qe_invalid; | |
| 20843 |
2/4✓ Branch 0 taken 405 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 405 times.
✗ Branch 3 not taken.
|
405 | if(!p_getbmap(&temp_zinit.gen_initd, f)) |
| 20844 | ✗ | return qe_invalid; | |
| 20845 |
2/4✓ Branch 0 taken 405 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 405 times.
✗ Branch 3 not taken.
|
405 | if(!p_getbmap(&temp_zinit.gen_eventstate, f)) |
| 20846 | ✗ | return qe_invalid; | |
| 20847 |
2/4✓ Branch 0 taken 405 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 405 times.
✗ Branch 3 not taken.
|
405 | if(!p_getbmap(&temp_zinit.gen_data, f)) |
| 20848 | ✗ | return qe_invalid; | |
| 20849 |
2/4✓ Branch 0 taken 405 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 405 times.
✗ Branch 3 not taken.
|
405 | if(!p_getbmap(&temp_zinit.screen_data, f)) |
| 20850 | ✗ | return qe_invalid; | |
| 20851 |
1/2✓ Branch 0 taken 405 times.
✗ Branch 1 not taken.
|
405 | if (s_version >= 38) |
| 20852 | { | ||
| 20853 |
2/4✓ Branch 0 taken 405 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 405 times.
✗ Branch 3 not taken.
|
405 | if (!p_getc(&temp_zinit.spriteflickerspeed, f)) |
| 20854 | ✗ | return qe_invalid; | |
| 20855 |
2/4✓ Branch 0 taken 405 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 405 times.
✗ Branch 3 not taken.
|
405 | if (!p_getc(&temp_zinit.spriteflickercolor, f)) |
| 20856 | ✗ | return qe_invalid; | |
| 20857 |
2/4✓ Branch 0 taken 405 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 405 times.
✗ Branch 3 not taken.
|
405 | if (!p_getc(&temp_zinit.spriteflickertransp, f)) |
| 20858 | ✗ | return qe_invalid; | |
| 20859 | 405 | } | |
| 20860 |
2/2✓ Branch 0 taken 105 times.
✓ Branch 1 taken 300 times.
|
405 | if(s_version >= 39) |
| 20861 |
2/4✓ Branch 0 taken 105 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 105 times.
✗ Branch 3 not taken.
|
105 | if(!p_igetzf(&temp_zinit.air_drag, f)) |
| 20862 | ✗ | return qe_invalid; | |
| 20863 | } | ||
| 20864 |
1/2✓ Branch 0 taken 694 times.
✗ Branch 1 not taken.
|
694 | if (should_skip) |
| 20865 | ✗ | return 0; | |
| 20866 | |||
| 20867 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 694 times.
|
694 | if(loading_tileset_flags & TILESET_CLEARMAPS) |
| 20868 | { | ||
| 20869 | ✗ | temp_zinit.last_map = 0; | |
| 20870 | ✗ | temp_zinit.last_screen = 0; | |
| 20871 | ✗ | temp_zinit.screen_data.clear(); | |
| 20872 | ✗ | } | |
| 20873 |
1/2✓ Branch 0 taken 694 times.
✗ Branch 1 not taken.
|
694 | temp_zinit.normalize(); |
| 20874 |
1/2✓ Branch 0 taken 694 times.
✗ Branch 1 not taken.
|
694 | zinit = temp_zinit; |
| 20875 | |||
| 20876 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 694 times.
|
694 | if(zinit.heroAnimationStyle==las_zelda3slow) |
| 20877 | { | ||
| 20878 | ✗ | hero_animation_speed=2; | |
| 20879 | ✗ | } | |
| 20880 | else | ||
| 20881 | { | ||
| 20882 | 694 | hero_animation_speed=1; | |
| 20883 | } | ||
| 20884 | |||
| 20885 | 694 | return 0; | |
| 20886 | 694 | } | |
| 20887 | |||
| 20888 | /* | ||
| 20889 | void setupitemdropsets() | ||
| 20890 | { | ||
| 20891 | for(int32_t i=0; i<isMAX; i++) | ||
| 20892 | { | ||
| 20893 | memcpy(&item_drop_sets[i], &default_item_drop_sets[i], sizeof(item_drop_object)); | ||
| 20894 | } | ||
| 20895 | } | ||
| 20896 | */ | ||
| 20897 | |||
| 20898 | 635 | int32_t readitemdropsets(PACKFILE *f, int32_t version, word build) | |
| 20899 | { | ||
| 20900 |
2/2✓ Branch 0 taken 612 times.
✓ Branch 1 taken 23 times.
|
635 | bool should_skip = legacy_skip_flags && get_bit(legacy_skip_flags, skip_itemdropsets); |
| 20901 | |||
| 20902 | 635 | build=build; // here to prevent compiler warnings | |
| 20903 | dword dummy_dword; | ||
| 20904 | 635 | word item_drop_sets_to_read=0; | |
| 20905 | item_drop_object tempitemdrop; | ||
| 20906 | 635 | word s_version=0, s_cversion=0; | |
| 20907 | |||
| 20908 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 635 times.
|
635 | if (!should_skip) |
| 20909 |
2/2✓ Branch 0 taken 162560 times.
✓ Branch 1 taken 635 times.
|
163195 | for(int32_t i=0; i<MAXITEMDROPSETS; i++) |
| 20910 | { | ||
| 20911 | 162560 | memset(&item_drop_sets[i], 0, sizeof(item_drop_object)); | |
| 20912 | 163195 | } | |
| 20913 | |||
| 20914 |
2/2✓ Branch 0 taken 612 times.
✓ Branch 1 taken 23 times.
|
635 | if(version > 0x192) |
| 20915 | { | ||
| 20916 | 612 | item_drop_sets_to_read=0; | |
| 20917 | |||
| 20918 | //section version info | ||
| 20919 |
1/2✓ Branch 0 taken 612 times.
✗ Branch 1 not taken.
|
612 | if(!p_igetw(&s_version,f)) |
| 20920 | { | ||
| 20921 | ✗ | return qe_invalid; | |
| 20922 | } | ||
| 20923 | |||
| 20924 | 612 | FFCore.quest_format[vItemDropsets] = s_version; | |
| 20925 | |||
| 20926 | //al_trace("Item drop sets version %d\n", s_version); | ||
| 20927 |
1/2✓ Branch 0 taken 612 times.
✗ Branch 1 not taken.
|
612 | if(!p_igetw(&s_cversion,f)) |
| 20928 | { | ||
| 20929 | ✗ | return qe_invalid; | |
| 20930 | } | ||
| 20931 | |||
| 20932 | //section size | ||
| 20933 |
1/2✓ Branch 0 taken 612 times.
✗ Branch 1 not taken.
|
612 | if(!p_igetl(&dummy_dword,f)) |
| 20934 | { | ||
| 20935 | ✗ | return qe_invalid; | |
| 20936 | } | ||
| 20937 | |||
| 20938 | //finally... section data | ||
| 20939 |
1/2✓ Branch 0 taken 612 times.
✗ Branch 1 not taken.
|
612 | if(!p_igetw(&item_drop_sets_to_read,f)) |
| 20940 | { | ||
| 20941 | ✗ | return qe_invalid; | |
| 20942 | } | ||
| 20943 | |||
| 20944 |
2/4✓ Branch 0 taken 612 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 612 times.
✗ Branch 3 not taken.
|
612 | if (!(item_drop_sets_to_read >= 0 && item_drop_sets_to_read <= MAXITEMDROPSETS)) |
| 20945 | { | ||
| 20946 | ✗ | return qe_invalid; | |
| 20947 | } | ||
| 20948 | 612 | } | |
| 20949 | else | ||
| 20950 | { | ||
| 20951 | 23 | init_item_drop_sets(); | |
| 20952 | } | ||
| 20953 | |||
| 20954 |
2/2✓ Branch 0 taken 23 times.
✓ Branch 1 taken 612 times.
|
635 | if(s_version>=1) |
| 20955 | { | ||
| 20956 |
2/2✓ Branch 0 taken 8791 times.
✓ Branch 1 taken 612 times.
|
9403 | for(int32_t i=0; i<item_drop_sets_to_read; i++) |
| 20957 | { | ||
| 20958 |
1/2✓ Branch 0 taken 8791 times.
✗ Branch 1 not taken.
|
8791 | if(!p_getstr(tempitemdrop.name,sizeof(tempitemdrop.name)-1,f)) |
| 20959 | { | ||
| 20960 | ✗ | return qe_invalid; | |
| 20961 | } | ||
| 20962 | |||
| 20963 |
2/2✓ Branch 0 taken 87910 times.
✓ Branch 1 taken 8791 times.
|
96701 | for(int32_t j=0; j<10; ++j) |
| 20964 | { | ||
| 20965 |
1/2✓ Branch 0 taken 87910 times.
✗ Branch 1 not taken.
|
87910 | if(!p_igetw(&tempitemdrop.item[j],f)) |
| 20966 | { | ||
| 20967 | ✗ | return qe_invalid; | |
| 20968 | } | ||
| 20969 | 87910 | } | |
| 20970 | |||
| 20971 |
2/2✓ Branch 0 taken 96701 times.
✓ Branch 1 taken 8791 times.
|
105492 | for(int32_t j=0; j<11; ++j) |
| 20972 | { | ||
| 20973 |
1/2✓ Branch 0 taken 96701 times.
✗ Branch 1 not taken.
|
96701 | if(!p_igetw(&tempitemdrop.chance[j],f)) |
| 20974 | { | ||
| 20975 | ✗ | return qe_invalid; | |
| 20976 | } | ||
| 20977 | 96701 | } | |
| 20978 | |||
| 20979 | // Dec 2008: Addition of the 'Tall Grass' set, #12, | ||
| 20980 | // overrides the quest's set #12. | ||
| 20981 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 8791 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
8791 | if(s_version<2 && i==12) |
| 20982 | ✗ | continue; | |
| 20983 | |||
| 20984 | // Deprecated: qr_NOCLOCKS and qr_ALLOW10RUPEEDROPS | ||
| 20985 |
1/4✓ Branch 0 taken 8791 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
8791 | if(s_version<2) for(int32_t j=0; j<10; ++j) |
| 20986 | { | ||
| 20987 | ✗ | int32_t it = tempitemdrop.item[j]; | |
| 20988 | |||
| 20989 | ✗ | if((itemsbuf[it].family == itype_rupee | |
| 20990 | ✗ | && ((itemsbuf[it].amount)&0xFFF) == 10) | |
| 20991 | ✗ | && !get_bit(deprecated_rules, qr_ALLOW10RUPEEDROPS_DEP)) | |
| 20992 | { | ||
| 20993 | ✗ | tempitemdrop.chance[j+1]=0; | |
| 20994 | ✗ | } | |
| 20995 | ✗ | else if(itemsbuf[it].family == itype_clock && get_bit(deprecated_rules, qr_NOCLOCKS_DEP)) | |
| 20996 | { | ||
| 20997 | ✗ | tempitemdrop.chance[j+1]=0; | |
| 20998 | ✗ | } | |
| 20999 | |||
| 21000 | // From Sept 2007 to Dec 2008, non-gameplay items were prohibited. | ||
| 21001 | ✗ | if(itemsbuf[it].family == itype_misc) | |
| 21002 | { | ||
| 21003 | // If a non-gameplay item was selected, then item drop was aborted. | ||
| 21004 | // Reflect this by increasing the 'Nothing' chance accordingly. | ||
| 21005 | ✗ | tempitemdrop.chance[0]+=tempitemdrop.chance[j+1]; | |
| 21006 | ✗ | tempitemdrop.chance[j+1]=0; | |
| 21007 | ✗ | } | |
| 21008 | ✗ | } | |
| 21009 | |||
| 21010 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 8791 times.
|
8791 | if (!should_skip) |
| 21011 | 8791 | memcpy(&item_drop_sets[i], &tempitemdrop, sizeof(item_drop_object)); | |
| 21012 | 8791 | } | |
| 21013 | 612 | } | |
| 21014 | |||
| 21015 | 635 | return 0; | |
| 21016 | 635 | } | |
| 21017 | |||
| 21018 | 612 | int32_t readfavorites(PACKFILE *f, int32_t, word) | |
| 21019 | { | ||
| 21020 |
1/2✓ Branch 0 taken 612 times.
✗ Branch 1 not taken.
|
612 | bool should_skip = legacy_skip_flags && get_bit(legacy_skip_flags, skip_favorites); |
| 21021 | |||
| 21022 | int32_t temp_num; | ||
| 21023 | dword dummy_dword; | ||
| 21024 | word num_favorite_combos; | ||
| 21025 | word num_favorite_combo_aliases; | ||
| 21026 | 612 | word s_version=0, s_cversion=0; | |
| 21027 | |||
| 21028 | //section version info | ||
| 21029 |
1/2✓ Branch 0 taken 612 times.
✗ Branch 1 not taken.
|
612 | if(!p_igetw(&s_version,f)) |
| 21030 | { | ||
| 21031 | ✗ | return qe_invalid; | |
| 21032 | } | ||
| 21033 | |||
| 21034 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 612 times.
|
612 | if (!should_skip) |
| 21035 | 612 | FFCore.quest_format[vFavourites] = s_version; | |
| 21036 | |||
| 21037 |
1/2✓ Branch 0 taken 612 times.
✗ Branch 1 not taken.
|
612 | if(!p_igetw(&s_cversion,f)) |
| 21038 | { | ||
| 21039 | ✗ | return qe_invalid; | |
| 21040 | } | ||
| 21041 | |||
| 21042 | //section size | ||
| 21043 |
1/2✓ Branch 0 taken 612 times.
✗ Branch 1 not taken.
|
612 | if(!p_igetl(&dummy_dword,f)) |
| 21044 | { | ||
| 21045 | ✗ | return qe_invalid; | |
| 21046 | } | ||
| 21047 | |||
| 21048 | 612 | word per_row = FAVORITECOMBO_PER_ROW; | |
| 21049 | 612 | word per_page = FAVORITECOMBO_PER_PAGE; | |
| 21050 |
2/2✓ Branch 0 taken 200 times.
✓ Branch 1 taken 412 times.
|
612 | if(s_version >= 3) |
| 21051 |
1/2✓ Branch 0 taken 412 times.
✗ Branch 1 not taken.
|
412 | if(!p_igetw(&per_row,f)) |
| 21052 | ✗ | return qe_invalid; | |
| 21053 |
2/2✓ Branch 0 taken 207 times.
✓ Branch 1 taken 405 times.
|
612 | if(s_version >= 4) |
| 21054 |
1/2✓ Branch 0 taken 405 times.
✗ Branch 1 not taken.
|
405 | if(!p_igetw(&per_page,f)) |
| 21055 | ✗ | return qe_invalid; | |
| 21056 | //finally... section data | ||
| 21057 |
1/2✓ Branch 0 taken 612 times.
✗ Branch 1 not taken.
|
612 | if(!p_igetw(&num_favorite_combos,f)) |
| 21058 | { | ||
| 21059 | ✗ | return qe_invalid; | |
| 21060 | } | ||
| 21061 | |||
| 21062 | //Hack; port old favorite combos | ||
| 21063 |
3/4✓ Branch 0 taken 200 times.
✓ Branch 1 taken 412 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 200 times.
|
612 | if(s_version < 3 && num_favorite_combos == 100) |
| 21064 | 200 | per_row = 13; | |
| 21065 | |||
| 21066 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 612 times.
|
612 | if (!should_skip) |
| 21067 |
2/2✓ Branch 0 taken 771120 times.
✓ Branch 1 taken 612 times.
|
771732 | for(int q = 0; q < MAXFAVORITECOMBOS; ++q) |
| 21068 | 771732 | favorite_combos[q] = -1; | |
| 21069 | 612 | byte favtype = 0; | |
| 21070 |
2/2✓ Branch 0 taken 63616 times.
✓ Branch 1 taken 612 times.
|
64228 | for(int32_t i=0; i<num_favorite_combos; i++) |
| 21071 | { | ||
| 21072 |
2/2✓ Branch 0 taken 43609 times.
✓ Branch 1 taken 20007 times.
|
63616 | if (s_version >= 4) |
| 21073 | { | ||
| 21074 |
1/2✓ Branch 0 taken 43609 times.
✗ Branch 1 not taken.
|
43609 | if (!p_getc(&favtype, f)) |
| 21075 | { | ||
| 21076 | ✗ | return qe_invalid; | |
| 21077 | } | ||
| 21078 | 43609 | } | |
| 21079 | else | ||
| 21080 | 20007 | favtype = 0; | |
| 21081 |
1/2✓ Branch 0 taken 63616 times.
✗ Branch 1 not taken.
|
63616 | if(!p_igetl(&temp_num,f)) |
| 21082 | { | ||
| 21083 | ✗ | return qe_invalid; | |
| 21084 | } | ||
| 21085 | |||
| 21086 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 63616 times.
|
63616 | if (should_skip) |
| 21087 | ✗ | continue; | |
| 21088 | |||
| 21089 |
2/2✓ Branch 0 taken 43609 times.
✓ Branch 1 taken 20007 times.
|
63616 | if(per_row == FAVORITECOMBO_PER_ROW) |
| 21090 | { | ||
| 21091 | 43609 | favorite_combos[i] = temp_num; | |
| 21092 | 43609 | favorite_combo_modes[i] = favtype; | |
| 21093 | 43609 | } | |
| 21094 | else | ||
| 21095 | { | ||
| 21096 | 20007 | int new_i = (i%per_row) + (i/per_row)*FAVORITECOMBO_PER_ROW; | |
| 21097 | 20007 | favorite_combos[new_i]=temp_num; | |
| 21098 | 20007 | favorite_combo_modes[new_i] = favtype; | |
| 21099 | } | ||
| 21100 | 63616 | } | |
| 21101 | |||
| 21102 | // Discard the separate favorite aliases list from previous versions | ||
| 21103 |
2/2✓ Branch 0 taken 405 times.
✓ Branch 1 taken 207 times.
|
612 | if(s_version<4) |
| 21104 | { | ||
| 21105 |
1/2✓ Branch 0 taken 207 times.
✗ Branch 1 not taken.
|
207 | if (!p_igetw(&num_favorite_combo_aliases, f)) |
| 21106 | { | ||
| 21107 | ✗ | return qe_invalid; | |
| 21108 | } | ||
| 21109 | |||
| 21110 |
2/2✓ Branch 0 taken 20000 times.
✓ Branch 1 taken 207 times.
|
20207 | for (int32_t i = 0; i < num_favorite_combo_aliases; i++) |
| 21111 | { | ||
| 21112 |
1/2✓ Branch 0 taken 20000 times.
✗ Branch 1 not taken.
|
20000 | if (!p_igetl(&temp_num, f)) |
| 21113 | { | ||
| 21114 | ✗ | return qe_invalid; | |
| 21115 | } | ||
| 21116 | 20000 | } | |
| 21117 | 207 | } | |
| 21118 | |||
| 21119 | 612 | word max_combo_cols = 0; | |
| 21120 | 612 | word max_mappages = 0; | |
| 21121 |
2/2✓ Branch 0 taken 200 times.
✓ Branch 1 taken 412 times.
|
612 | if(s_version >= 2) |
| 21122 | { | ||
| 21123 |
1/2✓ Branch 0 taken 412 times.
✗ Branch 1 not taken.
|
412 | if(!p_igetw(&max_combo_cols,f)) |
| 21124 | ✗ | return qe_invalid; | |
| 21125 | 412 | int32_t tmp = 0, tmp2 = 0, tmp3 = 0; | |
| 21126 |
2/2✓ Branch 0 taken 1648 times.
✓ Branch 1 taken 412 times.
|
2060 | for(int q = 0; q < max_combo_cols; ++q) |
| 21127 | { | ||
| 21128 |
1/2✓ Branch 0 taken 1648 times.
✗ Branch 1 not taken.
|
1648 | if(!p_igetl(&tmp,f)) |
| 21129 | ✗ | return qe_invalid; | |
| 21130 |
1/2✓ Branch 0 taken 1648 times.
✗ Branch 1 not taken.
|
1648 | if(!p_igetl(&tmp2,f)) |
| 21131 | ✗ | return qe_invalid; | |
| 21132 |
1/2✓ Branch 0 taken 1648 times.
✗ Branch 1 not taken.
|
1648 | if(!p_igetl(&tmp3,f)) |
| 21133 | ✗ | return qe_invalid; | |
| 21134 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1648 times.
|
1648 | if(q < MAX_COMBO_COLS) |
| 21135 | { | ||
| 21136 | 1648 | First[q] = tmp; | |
| 21137 | 1648 | combo_alistpos[q] = tmp2; | |
| 21138 | 1648 | combo_pool_listpos[q] = tmp3; | |
| 21139 | 1648 | } | |
| 21140 | 1648 | } | |
| 21141 | |||
| 21142 |
1/2✓ Branch 0 taken 412 times.
✗ Branch 1 not taken.
|
412 | if(!p_igetw(&max_mappages,f)) |
| 21143 | ✗ | return qe_invalid; | |
| 21144 |
2/2✓ Branch 0 taken 3708 times.
✓ Branch 1 taken 412 times.
|
4120 | for(int q = 0; q < max_mappages; ++q) |
| 21145 | { | ||
| 21146 |
1/2✓ Branch 0 taken 3708 times.
✗ Branch 1 not taken.
|
3708 | if(!p_igetl(&tmp,f)) |
| 21147 | ✗ | return qe_invalid; | |
| 21148 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 3708 times.
|
3708 | if(!p_igetl(&tmp2,f)) |
| 21149 | ✗ | return qe_invalid; | |
| 21150 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 3708 times.
|
3708 | if(q < MAX_MAPPAGE_BTNS) |
| 21151 | { | ||
| 21152 | 3708 | map_page[q].map = tmp; | |
| 21153 | 3708 | map_page[q].screen = tmp2; | |
| 21154 | 3708 | } | |
| 21155 | 3708 | } | |
| 21156 | 412 | } | |
| 21157 | |||
| 21158 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 612 times.
|
612 | if (should_skip) |
| 21159 | ✗ | return 0; | |
| 21160 | |||
| 21161 |
2/2✓ Branch 0 taken 800 times.
✓ Branch 1 taken 612 times.
|
1412 | for(int q = max_combo_cols; q < MAX_COMBO_COLS; ++q) |
| 21162 | { | ||
| 21163 | 800 | First[q] = 0; | |
| 21164 | 800 | combo_alistpos[q] = 0; | |
| 21165 | 800 | combo_pool_listpos[q] = 0; | |
| 21166 | 800 | } | |
| 21167 |
2/2✓ Branch 0 taken 1800 times.
✓ Branch 1 taken 612 times.
|
2412 | for(int q = max_mappages; q < MAX_MAPPAGE_BTNS; ++q) |
| 21168 | { | ||
| 21169 | 1800 | map_page[q].map = 0; | |
| 21170 | 1800 | map_page[q].screen = 0; | |
| 21171 | 1800 | } | |
| 21172 | |||
| 21173 | 612 | return 0; | |
| 21174 | 612 | } | |
| 21175 | |||
| 21176 | /* | ||
| 21177 | switch (ret) { | ||
| 21178 | case 0: | ||
| 21179 | break; | ||
| 21180 | |||
| 21181 | case qe_invalid: | ||
| 21182 | goto invalid; | ||
| 21183 | break; | ||
| 21184 | default: | ||
| 21185 | pack_fclose(f); | ||
| 21186 | if(!oldquest) | ||
| 21187 | delete_file(tmpfilename); | ||
| 21188 | return ret; | ||
| 21189 | break; | ||
| 21190 | } | ||
| 21191 | */ | ||
| 21192 | |||
| 21193 | const char *skip_text[skip_max]= | ||
| 21194 | { | ||
| 21195 | "skip_header", "skip_rules", "skip_strings", "skip_misc", | ||
| 21196 | "skip_tiles", "skip_combos", "skip_comboaliases", "skip_csets", | ||
| 21197 | "skip_maps", "skip_dmaps", "skip_doors", "skip_items", | ||
| 21198 | "skip_weapons", "skip_colors", "skip_icons", "skip_initdata", | ||
| 21199 | "skip_guys", "skip_herosprites", "skip_subscreens", "skip_ffscript", | ||
| 21200 | "skip_sfx", "skip_midis", "skip_cheats", "skip_itemdropsets", | ||
| 21201 | "skip_favorites" | ||
| 21202 | }; | ||
| 21203 | |||
| 21204 | |||
| 21205 | ✗ | void port250QuestRules(){ | |
| 21206 | |||
| 21207 | ✗ | portCandleRules(); //Candle | |
| 21208 | ✗ | portBombRules(); | |
| 21209 | |||
| 21210 | ✗ | } | |
| 21211 | |||
| 21212 | ✗ | void portCandleRules() | |
| 21213 | { | ||
| 21214 | ✗ | bool hurtshero = get_qr(qr_FIREPROOFHERO); | |
| 21215 | //itemdata itemsbuf; | ||
| 21216 | ✗ | for ( int32_t q = 0; q < MAXITEMS; q++ ) | |
| 21217 | { | ||
| 21218 | ✗ | if ( itemsbuf[q].family == itype_candle ) | |
| 21219 | { | ||
| 21220 | ✗ | if ( hurtshero ) itemsbuf[q].flags |= ITEM_FLAG2; | |
| 21221 | ✗ | else itemsbuf[q].flags &= ~ ITEM_FLAG2; | |
| 21222 | ✗ | } | |
| 21223 | ✗ | } | |
| 21224 | ✗ | } | |
| 21225 | |||
| 21226 | ✗ | void portBombRules() | |
| 21227 | { | ||
| 21228 | ✗ | bool hurtshero = get_qr(qr_OUCHBOMBS); | |
| 21229 | //itemdata itemsbuf; | ||
| 21230 | ✗ | for ( int32_t q = 0; q < MAXITEMS; q++ ) | |
| 21231 | { | ||
| 21232 | ✗ | if ( itemsbuf[q].family == itype_bomb ) | |
| 21233 | { | ||
| 21234 | ✗ | if ( hurtshero ) itemsbuf[q].flags |= ITEM_FLAG2; | |
| 21235 | ✗ | else itemsbuf[q].flags &= ~ ITEM_FLAG2; | |
| 21236 | ✗ | } | |
| 21237 | ✗ | } | |
| 21238 | ✗ | } | |
| 21239 | |||
| 21240 | 15981 | static int section_id_to_enum(int id) | |
| 21241 | { | ||
| 21242 |
24/27✗ Branch 0 not taken.
✓ Branch 1 taken 695 times.
✓ Branch 2 taken 695 times.
✓ Branch 3 taken 695 times.
✓ Branch 4 taken 695 times.
✓ Branch 5 taken 695 times.
✓ Branch 6 taken 612 times.
✓ Branch 7 taken 695 times.
✓ Branch 8 taken 695 times.
✓ Branch 9 taken 695 times.
✓ Branch 10 taken 695 times.
✓ Branch 11 taken 695 times.
✓ Branch 12 taken 695 times.
✓ Branch 13 taken 612 times.
✓ Branch 14 taken 612 times.
✓ Branch 15 taken 695 times.
✓ Branch 16 taken 695 times.
✓ Branch 17 taken 636 times.
✓ Branch 18 taken 612 times.
✓ Branch 19 taken 612 times.
✓ Branch 20 taken 612 times.
✓ Branch 21 taken 695 times.
✓ Branch 22 taken 695 times.
✓ Branch 23 taken 636 times.
✓ Branch 24 taken 612 times.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
|
15981 | switch (id) |
| 21243 | { | ||
| 21244 | ✗ | case ID_HEADER: return skip_header; | |
| 21245 | 695 | case ID_RULES: return skip_rules; | |
| 21246 | 695 | case ID_STRINGS: return skip_strings; | |
| 21247 | 695 | case ID_MISC: return skip_misc; | |
| 21248 | 695 | case ID_TILES: return skip_tiles; | |
| 21249 | 695 | case ID_COMBOS: return skip_combos; | |
| 21250 | 612 | case ID_COMBOALIASES: return skip_comboaliases; | |
| 21251 | 695 | case ID_CSETS: return skip_csets; | |
| 21252 | 695 | case ID_MAPS: return skip_maps; | |
| 21253 | 695 | case ID_DMAPS: return skip_dmaps; | |
| 21254 | 695 | case ID_DOORS: return skip_doors; | |
| 21255 | 695 | case ID_ITEMS: return skip_items; | |
| 21256 | 695 | case ID_WEAPONS: return skip_weapons; | |
| 21257 | 612 | case ID_COLORS: return skip_colors; | |
| 21258 | 612 | case ID_ICONS: return skip_icons; | |
| 21259 | 695 | case ID_INITDATA: return skip_initdata; | |
| 21260 | 695 | case ID_GUYS: return skip_guys; | |
| 21261 | 636 | case ID_HEROSPRITES: return skip_herosprites; | |
| 21262 | 612 | case ID_SUBSCREEN: return skip_subscreens; | |
| 21263 | 612 | case ID_FFSCRIPT: return skip_ffscript; | |
| 21264 | 612 | case ID_SFX: return skip_sfx; | |
| 21265 | 695 | case ID_MIDIS: return skip_midis; | |
| 21266 | 695 | case ID_CHEATS: return skip_cheats; | |
| 21267 | 636 | case ID_ITEMDROPSETS: return skip_itemdropsets; | |
| 21268 | 612 | case ID_FAVORITES: return skip_favorites; | |
| 21269 | ✗ | case ID_ZINFO: return skip_zinfo; | |
| 21270 | } | ||
| 21271 | |||
| 21272 | ✗ | return -1; | |
| 21273 | 15981 | } | |
| 21274 | |||
| 21275 | 15573 | static int maybe_skip_section(PACKFILE* f, dword& section_id, const byte* skip_flags) | |
| 21276 | { | ||
| 21277 | 15573 | int section_enum = section_id_to_enum(section_id); | |
| 21278 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 15573 times.
|
15573 | bool skip = section_enum >= 0 && get_bit(skip_flags, section_enum); |
| 21279 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 15573 times.
|
15573 | if (skip) |
| 21280 | { | ||
| 21281 | word s_version; | ||
| 21282 | ✗ | if (!p_igetw(&s_version,f)) | |
| 21283 | { | ||
| 21284 | ✗ | return qe_invalid; | |
| 21285 | } | ||
| 21286 | |||
| 21287 | word c_version; | ||
| 21288 | ✗ | if (!p_igetw(&c_version,f)) | |
| 21289 | { | ||
| 21290 | ✗ | return qe_invalid; | |
| 21291 | } | ||
| 21292 | |||
| 21293 | ✗ | if (section_id == ID_RULES && s_version > 16) | |
| 21294 | { | ||
| 21295 | dword dummy; | ||
| 21296 | ✗ | if (!p_igetl(&dummy,f)) | |
| 21297 | { | ||
| 21298 | ✗ | return qe_invalid; | |
| 21299 | } | ||
| 21300 | ✗ | } | |
| 21301 | |||
| 21302 | ✗ | if (section_id == ID_FFSCRIPT && s_version >= 18) | |
| 21303 | { | ||
| 21304 | word dummy; | ||
| 21305 | ✗ | if (!p_igetw(&dummy,f)) | |
| 21306 | { | ||
| 21307 | ✗ | return qe_invalid; | |
| 21308 | } | ||
| 21309 | ✗ | } | |
| 21310 | |||
| 21311 | dword section_length; | ||
| 21312 | ✗ | if (!p_igetl(§ion_length,f)) | |
| 21313 | { | ||
| 21314 | ✗ | return qe_invalid; | |
| 21315 | } | ||
| 21316 | |||
| 21317 | ✗ | if (pack_fseek(f, section_length)) | |
| 21318 | { | ||
| 21319 | ✗ | return qe_invalid; | |
| 21320 | } | ||
| 21321 | |||
| 21322 | ✗ | if (!pack_feof(f)) | |
| 21323 | { | ||
| 21324 | ✗ | if (!p_mgetl(§ion_id,f)) | |
| 21325 | { | ||
| 21326 | ✗ | return qe_invalid; | |
| 21327 | } | ||
| 21328 | ✗ | } | |
| 21329 | |||
| 21330 | ✗ | return qe_cancel; | |
| 21331 | } | ||
| 21332 | |||
| 21333 | 15573 | return qe_OK; | |
| 21334 | 15573 | } | |
| 21335 | |||
| 21336 | //Internal function for loadquest wrapper | ||
| 21337 | 695 | static int32_t _lq_int(const char *filename, zquestheader *Header, miscQdata *Misc, zctune *tunes, bool show_progress, byte *skip_flags, byte printmetadata) | |
| 21338 | { | ||
| 21339 | 695 | DMapEditorLastMaptileUsed = 0; | |
| 21340 | 695 | combosread=false; | |
| 21341 | 695 | mapsread=false; | |
| 21342 | 695 | fixffcs=false; | |
| 21343 | |||
| 21344 | 695 | bool do_clear_scripts = !get_bit(skip_flags,skip_ffscript); | |
| 21345 |
1/2✓ Branch 0 taken 695 times.
✗ Branch 1 not taken.
|
695 | if(loading_tileset_flags & TILESET_CLEARSCRIPTS) |
| 21346 | { | ||
| 21347 | ✗ | set_bit(skip_flags, skip_ffscript, 1); | |
| 21348 | ✗ | setZScriptVersion(V_FFSCRIPT); | |
| 21349 | ✗ | FFCore.quest_format[vFFScript] = V_FFSCRIPT; | |
| 21350 | ✗ | FFCore.quest_format[vLastCompile] = V_FFSCRIPT; | |
| 21351 | ✗ | do_clear_scripts = true; | |
| 21352 | ✗ | } | |
| 21353 |
1/2✓ Branch 0 taken 695 times.
✗ Branch 1 not taken.
|
695 | if(loading_tileset_flags & TILESET_CLEARMAPS) |
| 21354 | { | ||
| 21355 | ✗ | set_bit(skip_flags, skip_maps, 1); | |
| 21356 | ✗ | } | |
| 21357 | |||
| 21358 | // show_progress=true; | ||
| 21359 | char tmpfilename[L_tmpnam]; | ||
| 21360 | 695 | temp_name(tmpfilename); | |
| 21361 | // char percent_done[30]; | ||
| 21362 | 695 | bool catchup=false; | |
| 21363 | byte tempbyte; | ||
| 21364 | 695 | word old_map_count=map_count; | |
| 21365 | |||
| 21366 | 695 | byte old_quest_rules[QUESTRULES_NEW_SIZE] = {0}; | |
| 21367 | 695 | byte old_extra_rules[EXTRARULES_SIZE] = {0}; | |
| 21368 | 695 | byte old_midi_flags[MIDIFLAGS_SIZE] = {0}; | |
| 21369 | |||
| 21370 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 694 times.
|
695 | if(get_bit(skip_flags, skip_rules)) |
| 21371 | { | ||
| 21372 | 1 | memcpy(old_quest_rules, quest_rules, QUESTRULES_NEW_SIZE); | |
| 21373 | 1 | memcpy(old_extra_rules, extra_rules, EXTRARULES_SIZE); | |
| 21374 | 1 | } | |
| 21375 | |||
| 21376 | 695 | memset(quest_rules, 0, QUESTRULES_NEW_SIZE); //clear here to prevent any kind of carryover -Z | |
| 21377 | 695 | unpack_qrs(); | |
| 21378 | // memset(extra_rules, 0, EXTRARULES_SIZE); //clear here to prevent any kind of carryover -Z | ||
| 21379 | |||
| 21380 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 694 times.
|
695 | if(get_bit(skip_flags, skip_midis)) |
| 21381 | { | ||
| 21382 | 1 | memcpy(old_midi_flags, midi_flags, MIDIFLAGS_SIZE); | |
| 21383 | 1 | } | |
| 21384 | |||
| 21385 | |||
| 21386 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 694 times.
|
695 | if(do_clear_scripts) |
| 21387 | { | ||
| 21388 | 694 | zScript.clear(); | |
| 21389 | 694 | globalmap.clear(); | |
| 21390 | 694 | genericmap.clear(); | |
| 21391 | 694 | ffcmap.clear(); | |
| 21392 | 694 | itemmap.clear(); | |
| 21393 | 694 | npcmap.clear(); | |
| 21394 | 694 | ewpnmap.clear(); | |
| 21395 | 694 | lwpnmap.clear(); | |
| 21396 | 694 | playermap.clear(); | |
| 21397 | 694 | dmapmap.clear(); | |
| 21398 | 694 | screenmap.clear(); | |
| 21399 | 694 | itemspritemap.clear(); | |
| 21400 | 694 | comboscriptmap.clear(); | |
| 21401 | 694 | subscreenmap.clear(); | |
| 21402 | |||
| 21403 |
2/2✓ Branch 0 taken 354634 times.
✓ Branch 1 taken 694 times.
|
355328 | for(int32_t i=0; i<NUMSCRIPTFFC-1; i++) |
| 21404 | { | ||
| 21405 | 354634 | ffcmap[i].clear(); | |
| 21406 | 354634 | } | |
| 21407 | |||
| 21408 | 694 | globalmap[0].slotname = "Slot 1:"; | |
| 21409 | 694 | globalmap[0].scriptname = "~Init"; | |
| 21410 | 694 | globalmap[0].update(); | |
| 21411 | |||
| 21412 |
2/2✓ Branch 0 taken 4858 times.
✓ Branch 1 taken 694 times.
|
5552 | for(int32_t i=1; i<NUMSCRIPTGLOBAL; i++) |
| 21413 | { | ||
| 21414 | 4858 | globalmap[i].clear(); | |
| 21415 | 4858 | } | |
| 21416 | |||
| 21417 |
2/2✓ Branch 0 taken 176970 times.
✓ Branch 1 taken 694 times.
|
177664 | for(int32_t i=0; i<NUMSCRIPTITEM-1; i++) |
| 21418 | { | ||
| 21419 | 176970 | itemmap[i].clear(); | |
| 21420 | 176970 | } | |
| 21421 | |||
| 21422 | //new script types -- prevent carrying over to a quest that you load after reading them | ||
| 21423 | //e.g., a quest has an npc script, and you make a blank quest, that now believes that it has an npc script, too! | ||
| 21424 |
2/2✓ Branch 0 taken 176970 times.
✓ Branch 1 taken 694 times.
|
177664 | for(int32_t i=0; i<NUMSCRIPTGUYS-1; i++) |
| 21425 | { | ||
| 21426 | 176970 | npcmap[i].clear(); | |
| 21427 | 176970 | } | |
| 21428 |
2/2✓ Branch 0 taken 176970 times.
✓ Branch 1 taken 694 times.
|
177664 | for(int32_t i=0; i<NUMSCRIPTWEAPONS-1; i++) |
| 21429 | { | ||
| 21430 | 176970 | lwpnmap[i].clear(); | |
| 21431 | 176970 | } | |
| 21432 |
2/2✓ Branch 0 taken 176970 times.
✓ Branch 1 taken 694 times.
|
177664 | for(int32_t i=0; i<NUMSCRIPTWEAPONS-1; i++) |
| 21433 | { | ||
| 21434 | 176970 | ewpnmap[i].clear(); | |
| 21435 | 176970 | } | |
| 21436 |
2/2✓ Branch 0 taken 2776 times.
✓ Branch 1 taken 694 times.
|
3470 | for(int32_t i=0; i<NUMSCRIPTPLAYER-1; i++) |
| 21437 | { | ||
| 21438 | 2776 | playermap[i].clear(); | |
| 21439 | 2776 | } | |
| 21440 |
2/2✓ Branch 0 taken 176970 times.
✓ Branch 1 taken 694 times.
|
177664 | for(int32_t i=0; i<NUMSCRIPTSDMAP-1; i++) |
| 21441 | { | ||
| 21442 | 176970 | dmapmap[i].clear(); | |
| 21443 | 176970 | } | |
| 21444 |
2/2✓ Branch 0 taken 176970 times.
✓ Branch 1 taken 694 times.
|
177664 | for(int32_t i=0; i<NUMSCRIPTSCREEN-1; i++) |
| 21445 | { | ||
| 21446 | 176970 | screenmap[i].clear(); | |
| 21447 | 176970 | } | |
| 21448 |
2/2✓ Branch 0 taken 176970 times.
✓ Branch 1 taken 694 times.
|
177664 | for(int32_t i=0; i<NUMSCRIPTSITEMSPRITE-1; i++) |
| 21449 | { | ||
| 21450 | 176970 | itemspritemap[i].clear(); | |
| 21451 | 176970 | } | |
| 21452 |
2/2✓ Branch 0 taken 354634 times.
✓ Branch 1 taken 694 times.
|
355328 | for(int32_t i=0; i<NUMSCRIPTSCOMBODATA-1; i++) |
| 21453 | { | ||
| 21454 | 354634 | comboscriptmap[i].clear(); | |
| 21455 | 354634 | } | |
| 21456 |
2/2✓ Branch 0 taken 354634 times.
✓ Branch 1 taken 694 times.
|
355328 | for(int32_t i=0; i<NUMSCRIPTSGENERIC-1; i++) |
| 21457 | { | ||
| 21458 | 354634 | genericmap[i].clear(); | |
| 21459 | 354634 | } | |
| 21460 |
2/2✓ Branch 0 taken 176970 times.
✓ Branch 1 taken 694 times.
|
177664 | for(int32_t i=0; i<NUMSCRIPTSSUBSCREEN-1; i++) |
| 21461 | { | ||
| 21462 | 176970 | subscreenmap[i].clear(); | |
| 21463 | 176970 | } | |
| 21464 | |||
| 21465 | 694 | reset_scripts(); | |
| 21466 | 694 | } | |
| 21467 | |||
| 21468 | zquestheader tempheader; | ||
| 21469 | 695 | memset(&tempheader, 0, sizeof(zquestheader)); | |
| 21470 | 695 | zinfo tempzi; | |
| 21471 | 695 | tempzi.clear(); | |
| 21472 | 695 | load_tmp_zi = &tempzi; | |
| 21473 | |||
| 21474 | // oldquest flag is set when an unencrypted qst file is suspected. | ||
| 21475 | 695 | bool oldquest = false; | |
| 21476 | 695 | int32_t open_error=0; | |
| 21477 | 695 | PACKFILE *f=open_quest_file(&open_error, filename, show_progress); | |
| 21478 | |||
| 21479 |
1/2✓ Branch 0 taken 695 times.
✗ Branch 1 not taken.
|
695 | if (!f) |
| 21480 | { | ||
| 21481 | ASSERT(open_error != 0); | ||
| 21482 | ✗ | return open_error; | |
| 21483 | } | ||
| 21484 | char zinfofilename[2048]; | ||
| 21485 | 695 | replace_extension(zinfofilename, filename, "zinfo", 2047); | |
| 21486 | 695 | int32_t ret=0; | |
| 21487 | |||
| 21488 | //header | ||
| 21489 | 695 | box_out("Reading Header..."); | |
| 21490 | 695 | ret=readheader(f, &tempheader, printmetadata); | |
| 21491 |
1/5✗ Branch 0 not taken.
✓ Branch 1 taken 695 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
|
695 | checkstatus(ret); |
| 21492 | 695 | box_out("okay."); | |
| 21493 | 695 | box_eol(); | |
| 21494 | |||
| 21495 |
2/2✓ Branch 0 taken 272 times.
✓ Branch 1 taken 423 times.
|
695 | if(read_zinfo) |
| 21496 | { | ||
| 21497 | 423 | box_out("Reading ZInfo - "); | |
| 21498 |
2/2✓ Branch 0 taken 3 times.
✓ Branch 1 taken 420 times.
|
423 | box_out(read_ext_zinfo ? "External..." : "Internal..."); |
| 21499 |
2/2✓ Branch 0 taken 3 times.
✓ Branch 1 taken 420 times.
|
423 | if(read_ext_zinfo) |
| 21500 | { | ||
| 21501 | 3 | PACKFILE *inf=pack_fopen_password(zinfofilename, F_READ, ""); | |
| 21502 | 3 | ret=readzinfo(inf, tempzi, tempheader); | |
| 21503 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 3 times.
|
3 | if(inf) pack_fclose(inf); |
| 21504 |
1/5✗ Branch 0 not taken.
✓ Branch 1 taken 3 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
|
3 | checkstatus(ret); |
| 21505 | 3 | } | |
| 21506 | else | ||
| 21507 | { | ||
| 21508 | 420 | ret=readzinfo(f, tempzi, tempheader); | |
| 21509 |
1/5✗ Branch 0 not taken.
✓ Branch 1 taken 420 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
|
420 | checkstatus(ret); |
| 21510 | } | ||
| 21511 | 423 | box_out("okay."); | |
| 21512 | 423 | box_eol(); | |
| 21513 | 423 | } | |
| 21514 | |||
| 21515 |
2/2✓ Branch 0 taken 671 times.
✓ Branch 1 taken 24 times.
|
695 | if(tempheader.zelda_version>=0x193) |
| 21516 | { | ||
| 21517 | dword section_id; | ||
| 21518 | |||
| 21519 | //section id | ||
| 21520 |
1/2✓ Branch 0 taken 671 times.
✗ Branch 1 not taken.
|
671 | if(!p_mgetl(§ion_id,f)) |
| 21521 | { | ||
| 21522 | ✗ | goto invalid; | |
| 21523 | } | ||
| 21524 | |||
| 21525 | 671 | std::set<dword> seen_sections; | |
| 21526 | |||
| 21527 |
3/4✓ Branch 0 taken 16244 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 15573 times.
✓ Branch 3 taken 671 times.
|
16244 | while(!pack_feof(f)) |
| 21528 | { | ||
| 21529 |
2/4✓ Branch 0 taken 15573 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 15573 times.
✗ Branch 3 not taken.
|
15573 | if (seen_sections.contains(section_id)) |
| 21530 | ✗ | goto invalid; | |
| 21531 |
1/2✓ Branch 0 taken 15573 times.
✗ Branch 1 not taken.
|
15573 | seen_sections.insert(section_id); |
| 21532 | |||
| 21533 |
2/4✓ Branch 0 taken 15573 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 15573 times.
✗ Branch 3 not taken.
|
15573 | if (int retval = maybe_skip_section(f, section_id, skip_flags); retval != qe_OK) |
| 21534 | { | ||
| 21535 | ✗ | if (retval == qe_cancel) | |
| 21536 | ✗ | continue; | |
| 21537 | ✗ | checkstatus(retval); | |
| 21538 | ✗ | } | |
| 21539 | |||
| 21540 |
24/25✓ Branch 0 taken 671 times.
✓ Branch 1 taken 671 times.
✓ Branch 2 taken 671 times.
✓ Branch 3 taken 671 times.
✓ Branch 4 taken 671 times.
✓ Branch 5 taken 612 times.
✓ Branch 6 taken 671 times.
✓ Branch 7 taken 671 times.
✓ Branch 8 taken 671 times.
✓ Branch 9 taken 671 times.
✓ Branch 10 taken 671 times.
✓ Branch 11 taken 671 times.
✓ Branch 12 taken 612 times.
✓ Branch 13 taken 612 times.
✓ Branch 14 taken 671 times.
✓ Branch 15 taken 671 times.
✓ Branch 16 taken 612 times.
✓ Branch 17 taken 612 times.
✓ Branch 18 taken 612 times.
✓ Branch 19 taken 612 times.
✓ Branch 20 taken 671 times.
✓ Branch 21 taken 671 times.
✓ Branch 22 taken 612 times.
✓ Branch 23 taken 612 times.
✗ Branch 24 not taken.
|
15573 | switch(section_id) |
| 21541 | { | ||
| 21542 | case ID_RULES: | ||
| 21543 | |||
| 21544 | //rules | ||
| 21545 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 671 times.
|
671 | if(catchup) |
| 21546 | { | ||
| 21547 | ✗ | box_out("found."); | |
| 21548 | ✗ | box_eol(); | |
| 21549 | ✗ | catchup=false; | |
| 21550 | ✗ | } | |
| 21551 | |||
| 21552 |
1/2✓ Branch 0 taken 671 times.
✗ Branch 1 not taken.
|
671 | box_out("Reading Rules..."); |
| 21553 |
1/2✓ Branch 0 taken 671 times.
✗ Branch 1 not taken.
|
671 | ret=readrules(f, &tempheader); |
| 21554 |
1/9✗ Branch 0 not taken.
✗ Branch 1 not taken.
✓ Branch 2 taken 671 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
|
671 | checkstatus(ret); |
| 21555 |
1/2✓ Branch 0 taken 671 times.
✗ Branch 1 not taken.
|
671 | box_out("okay."); |
| 21556 |
1/2✓ Branch 0 taken 671 times.
✗ Branch 1 not taken.
|
671 | box_eol(); |
| 21557 | 671 | break; | |
| 21558 | |||
| 21559 | case ID_STRINGS: | ||
| 21560 | |||
| 21561 | //strings | ||
| 21562 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 671 times.
|
671 | if(catchup) |
| 21563 | { | ||
| 21564 | ✗ | box_out("found."); | |
| 21565 | ✗ | box_eol(); | |
| 21566 | ✗ | catchup=false; | |
| 21567 | ✗ | } | |
| 21568 | |||
| 21569 |
1/2✓ Branch 0 taken 671 times.
✗ Branch 1 not taken.
|
671 | box_out("Reading Strings..."); |
| 21570 |
1/2✓ Branch 0 taken 671 times.
✗ Branch 1 not taken.
|
671 | ret=readstrings(f, &tempheader); |
| 21571 |
1/9✗ Branch 0 not taken.
✓ Branch 1 taken 671 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
|
671 | checkstatus(ret); |
| 21572 |
1/2✓ Branch 0 taken 671 times.
✗ Branch 1 not taken.
|
671 | box_out("okay."); |
| 21573 |
1/2✓ Branch 0 taken 671 times.
✗ Branch 1 not taken.
|
671 | box_eol(); |
| 21574 | 671 | break; | |
| 21575 | |||
| 21576 | case ID_MISC: | ||
| 21577 | |||
| 21578 | //misc data | ||
| 21579 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 671 times.
|
671 | if(catchup) |
| 21580 | { | ||
| 21581 | ✗ | box_out("found."); | |
| 21582 | ✗ | box_eol(); | |
| 21583 | ✗ | catchup=false; | |
| 21584 | ✗ | } | |
| 21585 | |||
| 21586 |
1/2✓ Branch 0 taken 671 times.
✗ Branch 1 not taken.
|
671 | box_out("Reading Misc. Data..."); |
| 21587 |
1/2✓ Branch 0 taken 671 times.
✗ Branch 1 not taken.
|
671 | ret=readmisc(f, &tempheader, Misc); |
| 21588 |
1/9✓ Branch 0 taken 671 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
|
671 | checkstatus(ret); |
| 21589 |
1/2✓ Branch 0 taken 671 times.
✗ Branch 1 not taken.
|
671 | box_out("okay."); |
| 21590 |
1/2✓ Branch 0 taken 671 times.
✗ Branch 1 not taken.
|
671 | box_eol(); |
| 21591 | 671 | break; | |
| 21592 | |||
| 21593 | case ID_TILES: | ||
| 21594 | |||
| 21595 | //tiles | ||
| 21596 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 671 times.
|
671 | if(catchup) |
| 21597 | { | ||
| 21598 | ✗ | box_out("found."); | |
| 21599 | ✗ | box_eol(); | |
| 21600 | ✗ | catchup=false; | |
| 21601 | ✗ | } | |
| 21602 | |||
| 21603 |
1/2✓ Branch 0 taken 671 times.
✗ Branch 1 not taken.
|
671 | box_out("Reading Tiles..."); |
| 21604 |
1/2✓ Branch 0 taken 671 times.
✗ Branch 1 not taken.
|
671 | ret=readtiles(f, newtilebuf, &tempheader, tempheader.zelda_version, tempheader.build, 0, NEWMAXTILES, false); |
| 21605 |
1/9✓ Branch 0 taken 671 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
|
671 | checkstatus(ret); |
| 21606 |
1/2✓ Branch 0 taken 671 times.
✗ Branch 1 not taken.
|
671 | box_out("okay."); |
| 21607 |
1/2✓ Branch 0 taken 671 times.
✗ Branch 1 not taken.
|
671 | box_eol(); |
| 21608 | 671 | break; | |
| 21609 | |||
| 21610 | case ID_COMBOS: | ||
| 21611 | |||
| 21612 | //combos | ||
| 21613 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 671 times.
|
671 | if(catchup) |
| 21614 | { | ||
| 21615 | ✗ | box_out("found."); | |
| 21616 | ✗ | box_eol(); | |
| 21617 | ✗ | catchup=false; | |
| 21618 | ✗ | } | |
| 21619 | |||
| 21620 |
1/2✓ Branch 0 taken 671 times.
✗ Branch 1 not taken.
|
671 | box_out("Reading Combos..."); |
| 21621 |
1/2✓ Branch 0 taken 671 times.
✗ Branch 1 not taken.
|
671 | ret=readcombos(f, &tempheader, tempheader.zelda_version, tempheader.build, 0, MAXCOMBOS); |
| 21622 | 671 | combosread=true; | |
| 21623 |
1/9✓ Branch 0 taken 671 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
|
671 | checkstatus(ret); |
| 21624 |
1/2✓ Branch 0 taken 671 times.
✗ Branch 1 not taken.
|
671 | box_out("okay."); |
| 21625 |
1/2✓ Branch 0 taken 671 times.
✗ Branch 1 not taken.
|
671 | box_eol(); |
| 21626 | 671 | break; | |
| 21627 | |||
| 21628 | case ID_COMBOALIASES: | ||
| 21629 | |||
| 21630 | //combo aliases | ||
| 21631 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 612 times.
|
612 | if(catchup) |
| 21632 | { | ||
| 21633 | ✗ | box_out("found."); | |
| 21634 | ✗ | box_eol(); | |
| 21635 | ✗ | catchup=false; | |
| 21636 | ✗ | } | |
| 21637 | |||
| 21638 |
1/2✓ Branch 0 taken 612 times.
✗ Branch 1 not taken.
|
612 | box_out("Reading Combo Aliases..."); |
| 21639 |
1/2✓ Branch 0 taken 612 times.
✗ Branch 1 not taken.
|
612 | ret=readcomboaliases(f, &tempheader, tempheader.zelda_version, tempheader.build); |
| 21640 |
1/9✓ Branch 0 taken 612 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
|
612 | checkstatus(ret); |
| 21641 |
1/2✓ Branch 0 taken 612 times.
✗ Branch 1 not taken.
|
612 | box_out("okay."); |
| 21642 |
1/2✓ Branch 0 taken 612 times.
✗ Branch 1 not taken.
|
612 | box_eol(); |
| 21643 | 612 | break; | |
| 21644 | |||
| 21645 | case ID_CSETS: | ||
| 21646 | |||
| 21647 | //color data | ||
| 21648 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 671 times.
|
671 | if(catchup) |
| 21649 | { | ||
| 21650 | ✗ | box_out("found."); | |
| 21651 | ✗ | box_eol(); | |
| 21652 | ✗ | catchup=false; | |
| 21653 | ✗ | } | |
| 21654 | |||
| 21655 |
1/2✓ Branch 0 taken 671 times.
✗ Branch 1 not taken.
|
671 | box_out("Reading Color Data..."); |
| 21656 |
1/2✓ Branch 0 taken 671 times.
✗ Branch 1 not taken.
|
671 | ret=readcolordata(f, Misc, tempheader.zelda_version, tempheader.build, 0, newerpdTOTAL); |
| 21657 |
1/9✓ Branch 0 taken 671 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
|
671 | checkstatus(ret); |
| 21658 |
1/2✓ Branch 0 taken 671 times.
✗ Branch 1 not taken.
|
671 | box_out("okay."); |
| 21659 |
1/2✓ Branch 0 taken 671 times.
✗ Branch 1 not taken.
|
671 | box_eol(); |
| 21660 | 671 | break; | |
| 21661 | |||
| 21662 | case ID_MAPS: | ||
| 21663 | |||
| 21664 | //maps | ||
| 21665 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 671 times.
|
671 | if(catchup) |
| 21666 | { | ||
| 21667 | ✗ | box_out("found."); | |
| 21668 | ✗ | box_eol(); | |
| 21669 | ✗ | catchup=false; | |
| 21670 | ✗ | } | |
| 21671 | |||
| 21672 |
1/2✓ Branch 0 taken 671 times.
✗ Branch 1 not taken.
|
671 | box_out("Reading Maps..."); |
| 21673 |
1/2✓ Branch 0 taken 671 times.
✗ Branch 1 not taken.
|
671 | ret=readmaps(f, &tempheader); |
| 21674 | 671 | mapsread=true; | |
| 21675 |
1/9✗ Branch 0 not taken.
✓ Branch 1 taken 671 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
|
671 | checkstatus(ret); |
| 21676 |
1/2✓ Branch 0 taken 671 times.
✗ Branch 1 not taken.
|
671 | box_out("okay."); |
| 21677 |
1/2✓ Branch 0 taken 671 times.
✗ Branch 1 not taken.
|
671 | box_eol(); |
| 21678 | 671 | break; | |
| 21679 | |||
| 21680 | case ID_DMAPS: | ||
| 21681 | |||
| 21682 | //dmaps | ||
| 21683 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 671 times.
|
671 | if(catchup) |
| 21684 | { | ||
| 21685 | ✗ | box_out("found."); | |
| 21686 | ✗ | box_eol(); | |
| 21687 | ✗ | catchup=false; | |
| 21688 | ✗ | } | |
| 21689 | |||
| 21690 |
1/2✓ Branch 0 taken 671 times.
✗ Branch 1 not taken.
|
671 | box_out("Reading DMaps..."); |
| 21691 |
1/2✓ Branch 0 taken 671 times.
✗ Branch 1 not taken.
|
671 | ret=readdmaps(f, &tempheader, tempheader.zelda_version, tempheader.build, 0, MAXDMAPS); |
| 21692 |
1/9✓ Branch 0 taken 671 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
|
671 | checkstatus(ret); |
| 21693 |
1/2✓ Branch 0 taken 671 times.
✗ Branch 1 not taken.
|
671 | box_out("okay."); |
| 21694 |
1/2✓ Branch 0 taken 671 times.
✗ Branch 1 not taken.
|
671 | box_eol(); |
| 21695 | 671 | break; | |
| 21696 | |||
| 21697 | case ID_DOORS: | ||
| 21698 | |||
| 21699 | //door combo sets | ||
| 21700 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 671 times.
|
671 | if(catchup) |
| 21701 | { | ||
| 21702 | ✗ | box_out("found."); | |
| 21703 | ✗ | box_eol(); | |
| 21704 | ✗ | catchup=false; | |
| 21705 | ✗ | } | |
| 21706 | |||
| 21707 |
1/2✓ Branch 0 taken 671 times.
✗ Branch 1 not taken.
|
671 | box_out("Reading Doors..."); |
| 21708 |
1/2✓ Branch 0 taken 671 times.
✗ Branch 1 not taken.
|
671 | ret=readdoorcombosets(f, &tempheader); |
| 21709 |
1/9✗ Branch 0 not taken.
✓ Branch 1 taken 671 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
|
671 | checkstatus(ret); |
| 21710 |
1/2✓ Branch 0 taken 671 times.
✗ Branch 1 not taken.
|
671 | box_out("okay."); |
| 21711 |
1/2✓ Branch 0 taken 671 times.
✗ Branch 1 not taken.
|
671 | box_eol(); |
| 21712 | 671 | break; | |
| 21713 | |||
| 21714 | case ID_ITEMS: | ||
| 21715 | |||
| 21716 | //items | ||
| 21717 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 671 times.
|
671 | if(catchup) |
| 21718 | { | ||
| 21719 | ✗ | box_out("found."); | |
| 21720 | ✗ | box_eol(); | |
| 21721 | ✗ | catchup=false; | |
| 21722 | ✗ | } | |
| 21723 | |||
| 21724 |
1/2✓ Branch 0 taken 671 times.
✗ Branch 1 not taken.
|
671 | box_out("Reading Items..."); |
| 21725 |
1/2✓ Branch 0 taken 671 times.
✗ Branch 1 not taken.
|
671 | ret=readitems(f, tempheader.zelda_version, tempheader.build); |
| 21726 |
1/9✓ Branch 0 taken 671 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
|
671 | checkstatus(ret); |
| 21727 | |||
| 21728 |
1/2✓ Branch 0 taken 671 times.
✗ Branch 1 not taken.
|
671 | box_out("okay."); |
| 21729 |
1/2✓ Branch 0 taken 671 times.
✗ Branch 1 not taken.
|
671 | box_eol(); |
| 21730 | 671 | break; | |
| 21731 | |||
| 21732 | case ID_WEAPONS: | ||
| 21733 | |||
| 21734 | //weapons | ||
| 21735 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 671 times.
|
671 | if(catchup) |
| 21736 | { | ||
| 21737 | ✗ | box_out("found."); | |
| 21738 | ✗ | box_eol(); | |
| 21739 | ✗ | catchup=false; | |
| 21740 | ✗ | } | |
| 21741 | |||
| 21742 |
1/2✓ Branch 0 taken 671 times.
✗ Branch 1 not taken.
|
671 | box_out("Reading Weapons..."); |
| 21743 |
1/2✓ Branch 0 taken 671 times.
✗ Branch 1 not taken.
|
671 | ret=readweapons(f, &tempheader); |
| 21744 |
1/9✓ Branch 0 taken 671 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
|
671 | checkstatus(ret); |
| 21745 |
1/2✓ Branch 0 taken 671 times.
✗ Branch 1 not taken.
|
671 | box_out("okay."); |
| 21746 |
1/2✓ Branch 0 taken 671 times.
✗ Branch 1 not taken.
|
671 | box_eol(); |
| 21747 | 671 | break; | |
| 21748 | |||
| 21749 | case ID_COLORS: | ||
| 21750 | |||
| 21751 | //misc. colors | ||
| 21752 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 612 times.
|
612 | if(catchup) |
| 21753 | { | ||
| 21754 | ✗ | box_out("found."); | |
| 21755 | ✗ | box_eol(); | |
| 21756 | ✗ | catchup=false; | |
| 21757 | ✗ | } | |
| 21758 | |||
| 21759 |
1/2✓ Branch 0 taken 612 times.
✗ Branch 1 not taken.
|
612 | box_out("Reading Misc. Colors..."); |
| 21760 |
1/2✓ Branch 0 taken 612 times.
✗ Branch 1 not taken.
|
612 | ret=readmisccolors(f, &tempheader, Misc); |
| 21761 |
1/9✓ Branch 0 taken 612 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
|
612 | checkstatus(ret); |
| 21762 |
1/2✓ Branch 0 taken 612 times.
✗ Branch 1 not taken.
|
612 | box_out("okay."); |
| 21763 |
1/2✓ Branch 0 taken 612 times.
✗ Branch 1 not taken.
|
612 | box_eol(); |
| 21764 | 612 | break; | |
| 21765 | |||
| 21766 | case ID_ICONS: | ||
| 21767 | |||
| 21768 | //game icons | ||
| 21769 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 612 times.
|
612 | if(catchup) |
| 21770 | { | ||
| 21771 | ✗ | box_out("found."); | |
| 21772 | ✗ | box_eol(); | |
| 21773 | ✗ | catchup=false; | |
| 21774 | ✗ | } | |
| 21775 | |||
| 21776 |
1/2✓ Branch 0 taken 612 times.
✗ Branch 1 not taken.
|
612 | box_out("Reading Game Icons..."); |
| 21777 |
1/2✓ Branch 0 taken 612 times.
✗ Branch 1 not taken.
|
612 | ret=readgameicons(f, &tempheader, Misc); |
| 21778 |
1/9✗ Branch 0 not taken.
✓ Branch 1 taken 612 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
|
612 | checkstatus(ret); |
| 21779 |
1/2✓ Branch 0 taken 612 times.
✗ Branch 1 not taken.
|
612 | box_out("okay."); |
| 21780 |
1/2✓ Branch 0 taken 612 times.
✗ Branch 1 not taken.
|
612 | box_eol(); |
| 21781 | 612 | break; | |
| 21782 | |||
| 21783 | case ID_INITDATA: | ||
| 21784 | |||
| 21785 | //initialization data | ||
| 21786 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 671 times.
|
671 | if(catchup) |
| 21787 | { | ||
| 21788 | ✗ | box_out("found."); | |
| 21789 | ✗ | box_eol(); | |
| 21790 | ✗ | catchup=false; | |
| 21791 | ✗ | } | |
| 21792 | |||
| 21793 |
1/2✓ Branch 0 taken 671 times.
✗ Branch 1 not taken.
|
671 | box_out("Reading Init. Data..."); |
| 21794 |
1/2✓ Branch 0 taken 671 times.
✗ Branch 1 not taken.
|
671 | ret=readinitdata(f, &tempheader); |
| 21795 |
1/9✓ Branch 0 taken 671 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
|
671 | checkstatus(ret); |
| 21796 |
1/2✓ Branch 0 taken 671 times.
✗ Branch 1 not taken.
|
671 | box_out("okay."); |
| 21797 |
1/2✓ Branch 0 taken 671 times.
✗ Branch 1 not taken.
|
671 | box_eol(); |
| 21798 | |||
| 21799 |
2/4✓ Branch 0 taken 671 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 671 times.
|
671 | if(!get_bit(skip_flags, skip_subscreens)) |
| 21800 | { | ||
| 21801 |
2/2✓ Branch 0 taken 84 times.
✓ Branch 1 taken 587 times.
|
671 | if(subscr_mode!=ssdtMAX) //not using custom subscreens |
| 21802 | { | ||
| 21803 |
1/2✓ Branch 0 taken 84 times.
✗ Branch 1 not taken.
|
84 | setupsubscreens(); |
| 21804 | |||
| 21805 |
2/2✓ Branch 0 taken 43008 times.
✓ Branch 1 taken 84 times.
|
43092 | for(int32_t i=0; i<MAXDMAPS; ++i) |
| 21806 | { | ||
| 21807 | 43008 | int32_t type=DMaps[i].type&dmfTYPE; | |
| 21808 |
2/2✓ Branch 0 taken 1076 times.
✓ Branch 1 taken 41932 times.
|
43008 | DMaps[i].active_subscreen=(type == dmOVERW || type == dmBSOVERW)?0:1; |
| 21809 | 43008 | DMaps[i].passive_subscreen=(get_qr(qr_ENABLEMAGIC))?0:1; | |
| 21810 | 43008 | } | |
| 21811 | 84 | } | |
| 21812 | 671 | } | |
| 21813 | |||
| 21814 |
2/4✓ Branch 0 taken 671 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 671 times.
|
671 | if(!get_bit(skip_flags, skip_sfx)) |
| 21815 | { | ||
| 21816 | 671 | setupsfx(); | |
| 21817 | 671 | } | |
| 21818 | |||
| 21819 |
2/4✓ Branch 0 taken 671 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 671 times.
✗ Branch 3 not taken.
|
671 | if(!get_bit(skip_flags, skip_itemdropsets)) |
| 21820 | { | ||
| 21821 |
1/2✓ Branch 0 taken 671 times.
✗ Branch 1 not taken.
|
671 | init_item_drop_sets(); |
| 21822 | 671 | } | |
| 21823 | |||
| 21824 |
2/4✓ Branch 0 taken 671 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 671 times.
|
671 | if(!get_bit(skip_flags, skip_favorites)) |
| 21825 | { | ||
| 21826 | 671 | init_favorites(); | |
| 21827 | 671 | } | |
| 21828 | |||
| 21829 | 671 | break; | |
| 21830 | |||
| 21831 | case ID_GUYS: | ||
| 21832 | |||
| 21833 | //guys | ||
| 21834 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 671 times.
|
671 | if(catchup) |
| 21835 | { | ||
| 21836 | ✗ | box_out("found."); | |
| 21837 | ✗ | box_eol(); | |
| 21838 | ✗ | catchup=false; | |
| 21839 | ✗ | } | |
| 21840 | |||
| 21841 |
1/2✓ Branch 0 taken 671 times.
✗ Branch 1 not taken.
|
671 | box_out("Reading Custom Guy Data..."); |
| 21842 |
1/2✓ Branch 0 taken 671 times.
✗ Branch 1 not taken.
|
671 | ret=readguys(f, &tempheader); |
| 21843 |
1/9✗ Branch 0 not taken.
✓ Branch 1 taken 671 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
|
671 | checkstatus(ret); |
| 21844 |
1/2✓ Branch 0 taken 671 times.
✗ Branch 1 not taken.
|
671 | box_out("okay."); |
| 21845 |
1/2✓ Branch 0 taken 671 times.
✗ Branch 1 not taken.
|
671 | box_eol(); |
| 21846 | 671 | break; | |
| 21847 | |||
| 21848 | case ID_HEROSPRITES: | ||
| 21849 | |||
| 21850 | //player sprites | ||
| 21851 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 612 times.
|
612 | if(catchup) |
| 21852 | { | ||
| 21853 | ✗ | box_out("found."); | |
| 21854 | ✗ | box_eol(); | |
| 21855 | ✗ | catchup=false; | |
| 21856 | ✗ | } | |
| 21857 | |||
| 21858 |
1/2✓ Branch 0 taken 612 times.
✗ Branch 1 not taken.
|
612 | box_out("Reading Custom Player Sprite Data..."); |
| 21859 |
1/2✓ Branch 0 taken 612 times.
✗ Branch 1 not taken.
|
612 | ret=readherosprites(f, &tempheader); |
| 21860 |
1/9✓ Branch 0 taken 612 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
|
612 | checkstatus(ret); |
| 21861 |
1/2✓ Branch 0 taken 612 times.
✗ Branch 1 not taken.
|
612 | box_out("okay."); |
| 21862 |
1/2✓ Branch 0 taken 612 times.
✗ Branch 1 not taken.
|
612 | box_eol(); |
| 21863 | 612 | break; | |
| 21864 | |||
| 21865 | case ID_SUBSCREEN: | ||
| 21866 | |||
| 21867 | //custom subscreens | ||
| 21868 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 612 times.
|
612 | if(catchup) |
| 21869 | { | ||
| 21870 | ✗ | box_out("found."); | |
| 21871 | ✗ | box_eol(); | |
| 21872 | ✗ | catchup=false; | |
| 21873 | ✗ | } | |
| 21874 | |||
| 21875 |
1/2✓ Branch 0 taken 612 times.
✗ Branch 1 not taken.
|
612 | box_out("Reading Custom Subscreen Data..."); |
| 21876 |
1/2✓ Branch 0 taken 612 times.
✗ Branch 1 not taken.
|
612 | ret=readsubscreens(f); |
| 21877 |
1/9✓ Branch 0 taken 612 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
|
612 | checkstatus(ret); |
| 21878 |
1/2✓ Branch 0 taken 612 times.
✗ Branch 1 not taken.
|
612 | box_out("okay."); |
| 21879 |
1/2✓ Branch 0 taken 612 times.
✗ Branch 1 not taken.
|
612 | box_eol(); |
| 21880 | 612 | break; | |
| 21881 | |||
| 21882 | case ID_FFSCRIPT: | ||
| 21883 | |||
| 21884 | //Freeform combo scripts | ||
| 21885 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 612 times.
|
612 | if(catchup) |
| 21886 | { | ||
| 21887 | ✗ | box_out("found."); | |
| 21888 | ✗ | box_eol(); | |
| 21889 | ✗ | catchup=false; | |
| 21890 | ✗ | } | |
| 21891 | |||
| 21892 |
1/2✓ Branch 0 taken 612 times.
✗ Branch 1 not taken.
|
612 | box_out("Reading FF Script Data..."); |
| 21893 |
1/2✓ Branch 0 taken 612 times.
✗ Branch 1 not taken.
|
612 | ret=readffscript(f, &tempheader); |
| 21894 |
1/9✓ Branch 0 taken 612 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
|
612 | checkstatus(ret); |
| 21895 |
1/2✓ Branch 0 taken 612 times.
✗ Branch 1 not taken.
|
612 | box_out("okay."); |
| 21896 |
1/2✓ Branch 0 taken 612 times.
✗ Branch 1 not taken.
|
612 | box_eol(); |
| 21897 | 612 | break; | |
| 21898 | |||
| 21899 | case ID_SFX: | ||
| 21900 | |||
| 21901 | //SFX data | ||
| 21902 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 612 times.
|
612 | if(catchup) |
| 21903 | { | ||
| 21904 | ✗ | box_out("found."); | |
| 21905 | ✗ | box_eol(); | |
| 21906 | ✗ | catchup=false; | |
| 21907 | ✗ | } | |
| 21908 | |||
| 21909 |
1/2✓ Branch 0 taken 612 times.
✗ Branch 1 not taken.
|
612 | box_out("Reading SFX Data..."); |
| 21910 |
1/2✓ Branch 0 taken 612 times.
✗ Branch 1 not taken.
|
612 | ret=readsfx(f, &tempheader); |
| 21911 |
1/9✓ Branch 0 taken 612 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
|
612 | checkstatus(ret); |
| 21912 |
1/2✓ Branch 0 taken 612 times.
✗ Branch 1 not taken.
|
612 | box_out("okay."); |
| 21913 |
1/2✓ Branch 0 taken 612 times.
✗ Branch 1 not taken.
|
612 | box_eol(); |
| 21914 | 612 | break; | |
| 21915 | |||
| 21916 | case ID_MIDIS: | ||
| 21917 | |||
| 21918 | //midis | ||
| 21919 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 671 times.
|
671 | if(catchup) |
| 21920 | { | ||
| 21921 | ✗ | box_out("found."); | |
| 21922 | ✗ | box_eol(); | |
| 21923 | ✗ | catchup=false; | |
| 21924 | ✗ | } | |
| 21925 | |||
| 21926 |
1/2✓ Branch 0 taken 671 times.
✗ Branch 1 not taken.
|
671 | box_out("Reading Tunes..."); |
| 21927 |
1/2✓ Branch 0 taken 671 times.
✗ Branch 1 not taken.
|
671 | ret=readtunes(f, &tempheader, tunes); |
| 21928 |
1/9✓ Branch 0 taken 671 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
|
671 | checkstatus(ret); |
| 21929 |
1/2✓ Branch 0 taken 671 times.
✗ Branch 1 not taken.
|
671 | box_out("okay."); |
| 21930 |
1/2✓ Branch 0 taken 671 times.
✗ Branch 1 not taken.
|
671 | box_eol(); |
| 21931 | 671 | break; | |
| 21932 | |||
| 21933 | case ID_CHEATS: | ||
| 21934 | |||
| 21935 | //cheat codes | ||
| 21936 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 671 times.
|
671 | if(catchup) |
| 21937 | { | ||
| 21938 | ✗ | box_out("found."); | |
| 21939 | ✗ | box_eol(); | |
| 21940 | ✗ | catchup=false; | |
| 21941 | ✗ | } | |
| 21942 | |||
| 21943 |
1/2✓ Branch 0 taken 671 times.
✗ Branch 1 not taken.
|
671 | box_out("Reading Cheat Codes..."); |
| 21944 |
1/2✓ Branch 0 taken 671 times.
✗ Branch 1 not taken.
|
671 | ret=readcheatcodes(f, &tempheader); |
| 21945 |
1/9✓ Branch 0 taken 671 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
|
671 | checkstatus(ret); |
| 21946 |
1/2✓ Branch 0 taken 671 times.
✗ Branch 1 not taken.
|
671 | box_out("okay."); |
| 21947 |
1/2✓ Branch 0 taken 671 times.
✗ Branch 1 not taken.
|
671 | box_eol(); |
| 21948 | 671 | break; | |
| 21949 | |||
| 21950 | case ID_ITEMDROPSETS: | ||
| 21951 | |||
| 21952 | //item drop sets | ||
| 21953 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 612 times.
|
612 | if(catchup) |
| 21954 | { | ||
| 21955 | ✗ | box_out("found."); | |
| 21956 | ✗ | box_eol(); | |
| 21957 | ✗ | catchup=false; | |
| 21958 | ✗ | } | |
| 21959 | |||
| 21960 |
1/2✓ Branch 0 taken 612 times.
✗ Branch 1 not taken.
|
612 | box_out("Reading Item Drop Sets..."); |
| 21961 |
1/2✓ Branch 0 taken 612 times.
✗ Branch 1 not taken.
|
612 | ret=readitemdropsets(f, tempheader.zelda_version, tempheader.build); |
| 21962 |
1/9✗ Branch 0 not taken.
✓ Branch 1 taken 612 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
|
612 | checkstatus(ret); |
| 21963 |
1/2✓ Branch 0 taken 612 times.
✗ Branch 1 not taken.
|
612 | box_out("okay."); |
| 21964 |
1/2✓ Branch 0 taken 612 times.
✗ Branch 1 not taken.
|
612 | box_eol(); |
| 21965 | 612 | break; | |
| 21966 | |||
| 21967 | case ID_FAVORITES: | ||
| 21968 | |||
| 21969 | //favorite combos and combo aliases | ||
| 21970 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 612 times.
|
612 | if(catchup) |
| 21971 | { | ||
| 21972 | ✗ | box_out("found."); | |
| 21973 | ✗ | box_eol(); | |
| 21974 | ✗ | catchup=false; | |
| 21975 | ✗ | } | |
| 21976 | |||
| 21977 |
1/2✓ Branch 0 taken 612 times.
✗ Branch 1 not taken.
|
612 | box_out("Reading Favorite Combos..."); |
| 21978 |
1/2✓ Branch 0 taken 612 times.
✗ Branch 1 not taken.
|
612 | ret=readfavorites(f, tempheader.zelda_version, tempheader.build); |
| 21979 |
1/9✗ Branch 0 not taken.
✗ Branch 1 not taken.
✓ Branch 2 taken 612 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
|
612 | checkstatus(ret); |
| 21980 |
1/2✓ Branch 0 taken 612 times.
✗ Branch 1 not taken.
|
612 | box_out("okay."); |
| 21981 |
1/2✓ Branch 0 taken 612 times.
✗ Branch 1 not taken.
|
612 | box_eol(); |
| 21982 | 612 | break; | |
| 21983 | |||
| 21984 | default: | ||
| 21985 | ✗ | if(!catchup) | |
| 21986 | { | ||
| 21987 | ✗ | box_out("Bad token! Searching..."); | |
| 21988 | ✗ | box_eol(); | |
| 21989 | ✗ | } | |
| 21990 | |||
| 21991 | ✗ | catchup=true; | |
| 21992 | ✗ | break; | |
| 21993 | } | ||
| 21994 | |||
| 21995 | |||
| 21996 |
1/2✓ Branch 0 taken 15573 times.
✗ Branch 1 not taken.
|
15573 | if(catchup) |
| 21997 | { | ||
| 21998 | //section id | ||
| 21999 | ✗ | section_id=(section_id<<8); | |
| 22000 | |||
| 22001 | ✗ | if(!p_getc(&tempbyte,f)) | |
| 22002 | { | ||
| 22003 | ✗ | goto invalid; | |
| 22004 | } | ||
| 22005 | |||
| 22006 | ✗ | section_id+=tempbyte; | |
| 22007 | ✗ | } | |
| 22008 | |||
| 22009 | else | ||
| 22010 | { | ||
| 22011 | //section id | ||
| 22012 |
3/4✓ Branch 0 taken 15573 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 14902 times.
✓ Branch 3 taken 671 times.
|
15573 | if(!pack_feof(f)) |
| 22013 | { | ||
| 22014 |
2/4✓ Branch 0 taken 14902 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 14902 times.
✗ Branch 3 not taken.
|
14902 | if(!p_mgetl(§ion_id,f)) |
| 22015 | { | ||
| 22016 | ✗ | goto invalid; | |
| 22017 | } | ||
| 22018 | 14902 | } | |
| 22019 | } | ||
| 22020 | } | ||
| 22021 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 671 times.
|
671 | } |
| 22022 | else | ||
| 22023 | { | ||
| 22024 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
24 | std::vector<std::tuple<std::string, int32_t, std::function<int32_t()>>> hardcoded_sections = { |
| 22025 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
47 | { "Rules", ID_RULES, [&](){ return readrules(f, &tempheader); }}, |
| 22026 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
48 | { "Strings", ID_STRINGS, [&](){ return readstrings(f, &tempheader); }}, |
| 22027 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
48 | { "Doors", ID_DOORS, [&](){ return readdoorcombosets(f, &tempheader); }}, |
| 22028 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
48 | { "DMaps", ID_DMAPS, [&](){ return readdmaps(f, &tempheader, tempheader.zelda_version, tempheader.build, 0, MAXDMAPS); }}, |
| 22029 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
48 | { "Misc. Data", ID_MISC, [&](){ return readmisc(f, &tempheader, Misc); }}, |
| 22030 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
48 | { "Items", ID_ITEMS, [&](){ return readitems(f, tempheader.zelda_version, tempheader.build); }}, |
| 22031 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
48 | { "Weapons", ID_WEAPONS, [&](){ return readweapons(f, &tempheader); }}, |
| 22032 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
47 | { "Custom Guy Data", ID_GUYS, [&](){ return readguys(f, &tempheader); }}, |
| 22033 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
48 | { "Maps", ID_MAPS, [&](){ return readmaps(f, &tempheader); }}, |
| 22034 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
48 | { "Combos", ID_COMBOS, [&](){ return readcombos(f, &tempheader, tempheader.zelda_version, tempheader.build, 0, MAXCOMBOS); }}, |
| 22035 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
48 | { "Color Data", ID_CSETS, [&](){ return readcolordata(f, Misc, tempheader.zelda_version, tempheader.build, 0, newerpdTOTAL); }}, |
| 22036 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
48 | { "Tiles", ID_TILES, [&](){ return readtiles(f, newtilebuf, &tempheader, tempheader.zelda_version, tempheader.build, 0, NEWMAXTILES, false); }}, |
| 22037 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
47 | { "Tunes", ID_MIDIS, [&](){ return readtunes(f, &tempheader, tunes); }}, |
| 22038 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
47 | { "Cheat Codes", ID_CHEATS, [&](){ return readcheatcodes(f, &tempheader); }}, |
| 22039 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
47 | { "Init. Data", ID_INITDATA, [&](){ return readinitdata(f, &tempheader); }}, |
| 22040 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
47 | { "Custom Player Sprite Data", ID_HEROSPRITES, [&](){ return readherosprites2(f, -1, 0); }}, |
| 22041 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
47 | { "Up Default Item Drop Sets", ID_ITEMDROPSETS, [&](){ return readitemdropsets(f, -1, 0); }}, |
| 22042 | }; | ||
| 22043 | |||
| 22044 | 24 | legacy_skip_flags = skip_flags; | |
| 22045 |
2/2✓ Branch 0 taken 24 times.
✓ Branch 1 taken 408 times.
|
1250 | for (auto& [desc, section_id, fn] : hardcoded_sections) |
| 22046 | { | ||
| 22047 |
1/2✓ Branch 0 taken 408 times.
✗ Branch 1 not taken.
|
408 | int section_enum = section_id_to_enum(section_id); |
| 22048 |
2/4✓ Branch 0 taken 408 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 408 times.
✗ Branch 3 not taken.
|
408 | bool skip = section_enum >= 0 && get_bit(skip_flags, section_enum); |
| 22049 |
2/2✓ Branch 0 taken 392 times.
✓ Branch 1 taken 16 times.
|
408 | if (skip) |
| 22050 | { | ||
| 22051 | // Nothing to read. | ||
| 22052 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 15 times.
|
16 | if (section_id == ID_RULES) |
| 22053 | 1 | continue; | |
| 22054 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 14 times.
|
15 | if (section_id == ID_GUYS) |
| 22055 | 1 | continue; | |
| 22056 | |||
| 22057 | // Haven't looked at how to skip these, because we don't need to currently: the only | ||
| 22058 | // usage of skip_flags currently is all off except: header and tiles (see `load_imagebuf`). | ||
| 22059 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 13 times.
|
14 | if (section_id == ID_MIDIS) |
| 22060 | 1 | continue; | |
| 22061 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 12 times.
|
13 | if (section_id == ID_CHEATS) |
| 22062 | 1 | continue; | |
| 22063 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 11 times.
|
12 | if (section_id == ID_INITDATA) |
| 22064 | 1 | continue; | |
| 22065 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 10 times.
|
11 | if (section_id == ID_HEROSPRITES) |
| 22066 | 1 | continue; | |
| 22067 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 9 times.
|
10 | if (section_id == ID_ITEMDROPSETS) |
| 22068 | 1 | continue; | |
| 22069 | 9 | } | |
| 22070 | |||
| 22071 | // Would be nice, but old sections mostly did not save section sizes. We could advance by | ||
| 22072 | // a specific amount, but it'd be a lot of work to get it right. So, for old quests, let's just | ||
| 22073 | // read all the sections even if requested to skip some. | ||
| 22074 | // if (int retval = maybe_skip_section(f, section_id, skip_flags); retval != qe_OK) | ||
| 22075 | // { | ||
| 22076 | // if (retval == qe_cancel) | ||
| 22077 | // continue; | ||
| 22078 | // checkstatus(retval); | ||
| 22079 | // } | ||
| 22080 | |||
| 22081 |
3/6✓ Branch 0 taken 401 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 401 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 401 times.
✗ Branch 5 not taken.
|
802 | box_out(fmt::format("Reading {}...", desc).c_str()); |
| 22082 |
1/2✓ Branch 0 taken 401 times.
✗ Branch 1 not taken.
|
401 | ret = fn(); |
| 22083 |
1/9✗ Branch 0 not taken.
✗ Branch 1 not taken.
✓ Branch 2 taken 401 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
|
401 | checkstatus(ret); |
| 22084 |
1/2✓ Branch 0 taken 401 times.
✗ Branch 1 not taken.
|
401 | box_out("okay."); |
| 22085 |
1/2✓ Branch 0 taken 401 times.
✗ Branch 1 not taken.
|
401 | box_eol(); |
| 22086 | } | ||
| 22087 | 24 | legacy_skip_flags = nullptr; | |
| 22088 | |||
| 22089 |
3/4✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 23 times.
✓ Branch 3 taken 1 times.
|
24 | if(!get_bit(skip_flags, skip_subscreens)) |
| 22090 | { | ||
| 22091 |
1/2✓ Branch 0 taken 23 times.
✗ Branch 1 not taken.
|
23 | setupsubscreens(); |
| 22092 | |||
| 22093 |
2/2✓ Branch 0 taken 11776 times.
✓ Branch 1 taken 23 times.
|
11799 | for(int32_t i=0; i<MAXDMAPS; ++i) |
| 22094 | { | ||
| 22095 | 11776 | int32_t type=DMaps[i].type&dmfTYPE; | |
| 22096 |
2/2✓ Branch 0 taken 44 times.
✓ Branch 1 taken 11732 times.
|
11776 | DMaps[i].active_subscreen=(type == dmOVERW || type == dmBSOVERW)?0:1; |
| 22097 | 11776 | DMaps[i].passive_subscreen=(get_qr(qr_ENABLEMAGIC))?0:1; | |
| 22098 | 11776 | } | |
| 22099 | 23 | } | |
| 22100 | |||
| 22101 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
24 | box_out("Setting Up Default Sound Effects..."); |
| 22102 | |||
| 22103 |
3/4✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 23 times.
|
24 | if(!get_bit(skip_flags, skip_sfx)) |
| 22104 | 23 | setupsfx(); | |
| 22105 | |||
| 22106 |
3/4✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 23 times.
|
24 | if(!get_bit(skip_flags, skip_favorites)) |
| 22107 | 23 | init_favorites(); | |
| 22108 | |||
| 22109 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
24 | box_out("okay."); |
| 22110 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
24 | box_eol(); |
| 22111 |
1/3✗ Branch 0 not taken.
✗ Branch 1 not taken.
✓ Branch 2 taken 24 times.
|
24 | } |
| 22112 | |||
| 22113 | 695 | init_spritelists(); | |
| 22114 | |||
| 22115 | // check data | ||
| 22116 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 695 times.
|
695 | if(f) |
| 22117 | { | ||
| 22118 | 695 | pack_fclose(f); | |
| 22119 | 695 | } | |
| 22120 | 695 | clear_quest_tmpfile(); | |
| 22121 | |||
| 22122 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 695 times.
|
695 | if(!oldquest) |
| 22123 | { | ||
| 22124 |
1/2✓ Branch 0 taken 695 times.
✗ Branch 1 not taken.
|
695 | if(exists(tmpfilename)) |
| 22125 | { | ||
| 22126 | ✗ | delete_file(tmpfilename); | |
| 22127 | ✗ | } | |
| 22128 | 695 | } | |
| 22129 | |||
| 22130 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 695 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
695 | if(fixffcs && combosread && mapsread) |
| 22131 | { | ||
| 22132 | ✗ | for(int32_t i=0; i<map_count; i++) | |
| 22133 | { | ||
| 22134 | ✗ | for(int32_t j=0; j<MAPSCRS; j++) | |
| 22135 | { | ||
| 22136 | ✗ | for(int32_t m=0; m<32; m++) | |
| 22137 | { | ||
| 22138 | ✗ | if(combobuf[TheMaps[(i*MAPSCRS)+j].ffcs[m].data].type == cCHANGE) | |
| 22139 | ✗ | TheMaps[(i*MAPSCRS)+j].ffcs[m].flags|=ffCHANGER; | |
| 22140 | ✗ | } | |
| 22141 | ✗ | } | |
| 22142 | ✗ | } | |
| 22143 | ✗ | } | |
| 22144 | |||
| 22145 |
5/6✓ Branch 0 taken 60 times.
✓ Branch 1 taken 635 times.
✓ Branch 2 taken 59 times.
✓ Branch 3 taken 1 times.
✓ Branch 4 taken 59 times.
✗ Branch 5 not taken.
|
695 | if(get_qr(qr_CONTFULL_DEP) && !get_bit(skip_flags, skip_rules) && !get_bit(skip_flags, skip_initdata)) |
| 22146 | { | ||
| 22147 | 59 | set_qr(qr_CONTFULL_DEP, 0); | |
| 22148 | 59 | zinit.flags.set(INIT_FL_CONTPERCENT,true); | |
| 22149 | 59 | zinit.cont_heart=100; | |
| 22150 | 59 | zinit.counter[crLIFE]=zinit.mcounter[crLIFE]; | |
| 22151 | 59 | } | |
| 22152 | |||
| 22153 | 695 | box_out("Done."); | |
| 22154 | 695 | box_eol(); | |
| 22155 | 695 | box_end(false); | |
| 22156 | |||
| 22157 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 695 times.
|
695 | if(!get_bit(skip_flags, skip_header)) |
| 22158 | { | ||
| 22159 | 695 | memcpy(Header, &tempheader, sizeof(tempheader)); | |
| 22160 | 695 | } | |
| 22161 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 694 times.
|
695 | if(!get_bit(skip_flags, skip_zinfo)) |
| 22162 | { | ||
| 22163 | 694 | ZI.copyFrom(tempzi); | |
| 22164 | 694 | } | |
| 22165 | |||
| 22166 |
2/2✓ Branch 0 taken 694 times.
✓ Branch 1 taken 1 times.
|
695 | if(get_bit(skip_flags, skip_maps)) |
| 22167 | { | ||
| 22168 | 1 | map_count=old_map_count; | |
| 22169 | 1 | } | |
| 22170 | |||
| 22171 |
2/2✓ Branch 0 taken 694 times.
✓ Branch 1 taken 1 times.
|
695 | if(get_bit(skip_flags, skip_rules)) |
| 22172 | { | ||
| 22173 | 1 | memcpy(quest_rules, old_quest_rules, QUESTRULES_NEW_SIZE); | |
| 22174 | 1 | memcpy(extra_rules, old_extra_rules, EXTRARULES_SIZE); | |
| 22175 | 1 | unpack_qrs(); | |
| 22176 | 1 | } | |
| 22177 | |||
| 22178 |
2/2✓ Branch 0 taken 694 times.
✓ Branch 1 taken 1 times.
|
695 | if(get_bit(skip_flags, skip_midis)) |
| 22179 | { | ||
| 22180 | 1 | memcpy(midi_flags, old_midi_flags, MIDIFLAGS_SIZE); | |
| 22181 | 1 | } | |
| 22182 | |||
| 22183 |
2/2✓ Branch 0 taken 671 times.
✓ Branch 1 taken 24 times.
|
695 | if( FFCore.quest_format[vZelda] < 0x210 ) |
| 22184 | { | ||
| 22185 | 24 | zprint2("\n[QUEST METADATA]\n"); | |
| 22186 | |||
| 22187 |
3/13✗ Branch 0 not taken.
✗ Branch 1 not taken.
✓ Branch 2 taken 6 times.
✓ Branch 3 taken 12 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✓ Branch 8 taken 6 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
|
24 | switch(FFCore.quest_format[vZelda]) |
| 22188 | { | ||
| 22189 | case 0x193: | ||
| 22190 | { | ||
| 22191 | ✗ | zprint2("Last saved in version: 1.93, Beta %d\n", FFCore.quest_format[vBuild]); break; | |
| 22192 | } | ||
| 22193 | case 0x192: | ||
| 22194 | { | ||
| 22195 | 6 | zprint2("Last saved in version: 1.92, Beta %d\n", FFCore.quest_format[vBuild]); break; | |
| 22196 | } | ||
| 22197 | case 0x190: | ||
| 22198 | { | ||
| 22199 | 12 | zprint2("Last saved in version: 1.90"); | |
| 22200 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 12 times.
|
12 | if ( FFCore.quest_format[vBuild] ) zprint2(", Beta/Build %d\n", FFCore.quest_format[vBuild]); |
| 22201 | 12 | else zprint2("\n"); | |
| 22202 | 12 | break; | |
| 22203 | } | ||
| 22204 | case 0x188: | ||
| 22205 | { | ||
| 22206 | ✗ | zprint2("Last saved in version: 1.88"); | |
| 22207 | ✗ | if ( FFCore.quest_format[vBuild] ) zprint2(", Beta/Build %d\n", FFCore.quest_format[vBuild]); | |
| 22208 | ✗ | else zprint2("\n"); | |
| 22209 | ✗ | break; | |
| 22210 | } | ||
| 22211 | case 0x187: | ||
| 22212 | { | ||
| 22213 | ✗ | zprint2("Last saved in version: 1.87"); | |
| 22214 | ✗ | if ( FFCore.quest_format[vBuild] ) zprint2(", Beta/Build %d\n", FFCore.quest_format[vBuild]); | |
| 22215 | ✗ | else zprint2("\n"); | |
| 22216 | ✗ | break; | |
| 22217 | } | ||
| 22218 | case 0x186: | ||
| 22219 | { | ||
| 22220 | ✗ | zprint2("Last saved in version: 1.86"); | |
| 22221 | ✗ | if ( FFCore.quest_format[vBuild] ) zprint2(", Beta/Build %d\n", FFCore.quest_format[vBuild]); | |
| 22222 | ✗ | else zprint2("\n"); | |
| 22223 | ✗ | break; | |
| 22224 | } | ||
| 22225 | case 0x185: | ||
| 22226 | { | ||
| 22227 | ✗ | zprint2("Last saved in version: 1.85"); | |
| 22228 | ✗ | if ( FFCore.quest_format[vBuild] ) zprint2(", Beta/Build %d\n", FFCore.quest_format[vBuild]); | |
| 22229 | ✗ | else zprint2("\n"); | |
| 22230 | ✗ | break; | |
| 22231 | } | ||
| 22232 | case 0x184: | ||
| 22233 | { | ||
| 22234 | 6 | zprint2("Last saved in version: 1.84"); | |
| 22235 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 6 times.
|
6 | if ( FFCore.quest_format[vBuild] ) zprint2(", Beta/Build %d\n", FFCore.quest_format[vBuild]); |
| 22236 | 6 | else zprint2("\n"); | |
| 22237 | 6 | break; | |
| 22238 | } | ||
| 22239 | case 0x183: | ||
| 22240 | { | ||
| 22241 | ✗ | zprint2("Last saved in version: 1.83"); | |
| 22242 | ✗ | if ( FFCore.quest_format[vBuild] ) zprint2(", Beta/Build %d\n", FFCore.quest_format[vBuild]); | |
| 22243 | ✗ | else zprint2("\n"); | |
| 22244 | ✗ | break; | |
| 22245 | } | ||
| 22246 | case 0x182: | ||
| 22247 | { | ||
| 22248 | ✗ | zprint2("Last saved in version: 1.82"); | |
| 22249 | ✗ | if ( FFCore.quest_format[vBuild] ) zprint2(", Beta/Build %d\n", FFCore.quest_format[vBuild]); | |
| 22250 | ✗ | else zprint2("\n"); | |
| 22251 | ✗ | break; | |
| 22252 | } | ||
| 22253 | case 0x181: | ||
| 22254 | { | ||
| 22255 | ✗ | zprint2("Last saved in version: 1.81"); | |
| 22256 | ✗ | if ( FFCore.quest_format[vBuild] ) zprint2(", Beta/Build %d\n", FFCore.quest_format[vBuild]); | |
| 22257 | ✗ | else zprint2("\n"); | |
| 22258 | ✗ | break; | |
| 22259 | } | ||
| 22260 | case 0x180: | ||
| 22261 | { | ||
| 22262 | ✗ | zprint2("Last saved in version: 1.80"); | |
| 22263 | ✗ | if ( FFCore.quest_format[vBuild] ) zprint2(", Beta/Build %d\n", FFCore.quest_format[vBuild]); | |
| 22264 | ✗ | else zprint2("\n"); | |
| 22265 | ✗ | break; | |
| 22266 | } | ||
| 22267 | default: | ||
| 22268 | { | ||
| 22269 | ✗ | zprint2("Last saved in version: %x, Beta %d\n", FFCore.quest_format[vZelda],FFCore.quest_format[vBuild]); break; | |
| 22270 | } | ||
| 22271 | } | ||
| 22272 | 24 | } | |
| 22273 | |||
| 22274 |
1/2✓ Branch 0 taken 695 times.
✗ Branch 1 not taken.
|
695 | if(loading_tileset_flags & TILESET_CLEARMAPS) |
| 22275 | { | ||
| 22276 | ✗ | TheMaps.clear(); | |
| 22277 | ✗ | TheMaps.resize(MAPSCRS*1); | |
| 22278 | ✗ | map_count = 1; | |
| 22279 | ✗ | map_autolayers.clear(); | |
| 22280 | ✗ | map_autolayers.resize(6*1); | |
| 22281 | ✗ | for(size_t i = 0; i < MAPSCRS; ++i) | |
| 22282 | { | ||
| 22283 | ✗ | TheMaps[i].zero_memory(); | |
| 22284 | ✗ | } | |
| 22285 | ✗ | } | |
| 22286 |
1/2✓ Branch 0 taken 695 times.
✗ Branch 1 not taken.
|
695 | if(loading_tileset_flags & TILESET_CLEARHEADER) |
| 22287 | { | ||
| 22288 | ✗ | memset(Header->password, 0, sizeof(Header->password)); | |
| 22289 | ✗ | memset(Header->minver, 0, sizeof(Header->minver)); | |
| 22290 | ✗ | memset(Header->title, 0, sizeof(Header->title)); | |
| 22291 | ✗ | memset(Header->author, 0, sizeof(Header->author)); | |
| 22292 | ✗ | memset(Header->version, 0, sizeof(Header->version)); | |
| 22293 | ✗ | Header->use_keyfile = 0; | |
| 22294 | ✗ | Header->dirty_password = false; | |
| 22295 | cvs_MD5Context ctx; | ||
| 22296 | ✗ | cvs_MD5Init(&ctx); | |
| 22297 | ✗ | cvs_MD5Update(&ctx, (const uint8_t*)"", 0); | |
| 22298 | ✗ | cvs_MD5Final(Header->pwd_hash, &ctx); | |
| 22299 | ✗ | } | |
| 22300 | |||
| 22301 | 695 | return qe_OK; | |
| 22302 | |||
| 22303 | invalid: | ||
| 22304 | // TODO: It's too easy to forget to jump to this label, and accidentally leave the file open. | ||
| 22305 | // Should wrap PACKFILE in a std::unique_pointer with a custom deallocator. | ||
| 22306 | ✗ | box_out("error."); | |
| 22307 | ✗ | box_eol(); | |
| 22308 | ✗ | box_end(true); | |
| 22309 | |||
| 22310 | ✗ | pack_fclose(f); | |
| 22311 | |||
| 22312 | ✗ | if(!oldquest) | |
| 22313 | { | ||
| 22314 | ✗ | if(exists(tmpfilename)) | |
| 22315 | { | ||
| 22316 | ✗ | delete_file(tmpfilename); | |
| 22317 | ✗ | } | |
| 22318 | ✗ | } | |
| 22319 | |||
| 22320 | ✗ | return qe_invalid; | |
| 22321 | |||
| 22322 | 695 | } | |
| 22323 | |||
| 22324 | static bool _is_loading_quest; | ||
| 22325 | |||
| 22326 | ✗ | bool is_loading_quest() | |
| 22327 | { | ||
| 22328 | ✗ | return _is_loading_quest; | |
| 22329 | } | ||
| 22330 | |||
| 22331 | 695 | int32_t loadquest(const char *filename, zquestheader *Header, miscQdata *Misc, | |
| 22332 | zctune *tunes, bool show_progress, byte *skip_flags, byte printmetadata, | ||
| 22333 | bool report, byte qst_num, dword tilesetflags) | ||
| 22334 | { | ||
| 22335 | 695 | loading_tileset_flags = tilesetflags; | |
| 22336 | 695 | const char* basename = get_filename(filename); | |
| 22337 | 695 | zapp_reporting_add_breadcrumb("load_quest", basename); | |
| 22338 | 695 | zapp_reporting_set_tag("qst.filename", basename); | |
| 22339 | |||
| 22340 | 695 | loading_qst_name = filename; | |
| 22341 | 695 | loading_qst_num = qst_num; | |
| 22342 | // In CI, builds are cached for replay tests, which can result in their build dates being earlier than what it would be locally. | ||
| 22343 | // So to avoid a more-recently updated .qst file from hitting the "last saved in a newer version" prompt, we disable in CI. | ||
| 22344 |
1/2✓ Branch 0 taken 695 times.
✗ Branch 1 not taken.
|
695 | if (!is_ci()) |
| 22345 | ✗ | loadquest_report = report; | |
| 22346 | |||
| 22347 | 695 | _is_loading_quest = true; | |
| 22348 | 695 | auto start = std::chrono::steady_clock::now(); | |
| 22349 | 695 | int32_t ret = _lq_int(filename, Header, Misc, tunes, show_progress, skip_flags, printmetadata); | |
| 22350 | 695 | int32_t load_ms = std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::steady_clock::now() - start).count(); | |
| 22351 | 695 | zprint2("Time to load qst: %d ms\n", load_ms); | |
| 22352 | 695 | _is_loading_quest = false; | |
| 22353 | |||
| 22354 |
2/2✓ Branch 0 taken 694 times.
✓ Branch 1 taken 1 times.
|
695 | if(show_progress) |
| 22355 | { | ||
| 22356 |
1/2✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
|
1 | if(ret) |
| 22357 | { | ||
| 22358 | ✗ | box_out("-- Error loading quest file! --"); | |
| 22359 | ✗ | box_end(true); | |
| 22360 | ✗ | } | |
| 22361 | 1 | else box_end(false); | |
| 22362 | 1 | } | |
| 22363 | |||
| 22364 | 695 | load_tmp_zi = NULL; | |
| 22365 | 695 | loading_qst_name = NULL; | |
| 22366 | 695 | loadquest_report = false; | |
| 22367 | 695 | loading_qst_num = 0; | |
| 22368 | |||
| 22369 | 695 | zapp_reporting_set_tag("qst.author", Header->author); | |
| 22370 | 695 | zapp_reporting_set_tag("qst.title", Header->title); | |
| 22371 | 695 | zapp_reporting_set_tag("qst.zc_version", Header->getVerStr()); | |
| 22372 | |||
| 22373 | 695 | return ret; | |
| 22374 | } | ||
| 22375 |